You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Importing configurations from external file](#importing-configurations-from-external-file)
@@ -251,14 +251,14 @@ class PersonService {
251
251
}
252
252
```
253
253
254
-
## The @OnlyContainerCanInstantiate annotation
255
-
The @OnlyContainerCanInstantiate annotation transforms the annotated class, changing its constructor. So, it will only be able to create new instances for the decorated class through to the IoC Container.
254
+
## The @OnlyInstantiableByContainer annotation
255
+
The @OnlyInstantiableByContainer annotation transforms the annotated class, changing its constructor. So, it will only be able to create new instances for the decorated class through to the IoC Container.
256
256
257
257
It is usefull, for example, to avoid direct instantiation of Singletons.
258
258
259
259
```typescript
260
260
@Singleton
261
-
@OnlyContainerCanInstantiate
261
+
@OnlyInstantiableByContainer
262
262
classPersonService {
263
263
@Inject
264
264
private personDAO:PersonDAO;
@@ -302,12 +302,12 @@ let otherPersonDAO: PersonDAO = new PersonDAO();
302
302
```
303
303
304
304
```typescript
305
-
@OnlyContainerCanInstantiate
305
+
@OnlyInstantiableByContainer
306
306
@Singleton
307
307
classPersonDAO {
308
308
}
309
309
310
-
let p:PersonDAO=newPersonDAO(); // throws a TypeError. classes decorated with @OnlyContainerCanInstantiate can not be instantiated directly
310
+
let p:PersonDAO=newPersonDAO(); // throws a TypeError. classes decorated with @OnlyInstantiableByContainer can not be instantiated directly
Container.bind(PersonDAO).factory(personFactory); //Works OK
@@ -548,9 +548,9 @@ If you need to support es5 code, you can keep using the 1.2.6 version
548
548
549
549
#### @AutoWired renamed
550
550
551
-
A lot of confusion with ```@AutoWired``` motivated us to rename it to ```@OnlyContainerCanInstantiate```. It is a big name, but it says exactly what that decorator does. It is completely optional (The container will always work in the same way when instrumenting the types), but it transforms the decorated constructor to avoid that anybody create new instances calling direct a new expression.
551
+
A lot of confusion with ```@AutoWired``` motivated us to rename it to ```@OnlyInstantiableByContainer```. It is a big name, but it says exactly what that decorator does. It is completely optional (The container will always work in the same way when instrumenting the types), but it transforms the decorated constructor to avoid that anybody create new instances calling direct a new expression.
552
552
553
-
So you need to change all references to ```@AutoWired``` to ```@OnlyContainerCanInstantiate```.
553
+
So you need to change all references to ```@AutoWired``` to ```@OnlyInstantiableByContainer```.
554
554
555
555
#### @Provided@Provides and Provider interface removed
0 commit comments