@@ -11,7 +11,7 @@ import {
11
11
createBindingFromClass ,
12
12
} from '@loopback/context' ;
13
13
import { Component , mountComponent } from './component' ;
14
- import { CoreBindings } from './keys' ;
14
+ import { CoreBindings , CoreTags } from './keys' ;
15
15
import { Server } from './server' ;
16
16
17
17
/**
@@ -21,7 +21,7 @@ import {Server} from './server';
21
21
*/
22
22
export class Application extends Context {
23
23
constructor ( public options : ApplicationConfig = { } ) {
24
- super ( ) ;
24
+ super ( 'application' ) ;
25
25
26
26
// Bind to self to allow injection of application context in other modules.
27
27
this . bind ( CoreBindings . APPLICATION_INSTANCE ) . to ( this ) ;
@@ -48,8 +48,8 @@ export class Application extends Context {
48
48
controller ( controllerCtor : ControllerClass , name ?: string ) : Binding {
49
49
const binding = createBindingFromClass ( controllerCtor , {
50
50
name,
51
- namespace : 'controllers' ,
52
- type : 'controller' ,
51
+ namespace : CoreBindings . CONTROLLERS ,
52
+ type : CoreTags . CONTROLLER ,
53
53
defaultScope : BindingScope . TRANSIENT ,
54
54
} ) ;
55
55
this . add ( binding ) ;
@@ -80,7 +80,7 @@ export class Application extends Context {
80
80
const binding = createBindingFromClass ( ctor , {
81
81
name,
82
82
namespace : CoreBindings . SERVERS ,
83
- type : 'server' ,
83
+ type : CoreTags . SERVER ,
84
84
defaultScope : BindingScope . SINGLETON ,
85
85
} ) ;
86
86
this . add ( binding ) ;
@@ -122,7 +122,7 @@ export class Application extends Context {
122
122
* @memberof Application
123
123
*/
124
124
public async getServer < T extends Server > (
125
- target : Constructor < T > | String ,
125
+ target : Constructor < T > | string ,
126
126
) : Promise < T > {
127
127
let key : string ;
128
128
// instanceof check not reliable for string.
@@ -196,8 +196,8 @@ export class Application extends Context {
196
196
public component ( componentCtor : Constructor < Component > , name ?: string ) {
197
197
const binding = createBindingFromClass ( componentCtor , {
198
198
name,
199
- namespace : 'components' ,
200
- type : 'component' ,
199
+ namespace : CoreBindings . COMPONENTS ,
200
+ type : CoreTags . COMPONENT ,
201
201
defaultScope : BindingScope . SINGLETON ,
202
202
} ) ;
203
203
this . add ( binding ) ;
0 commit comments