Closed jinsankim closed 4 years ago
It feels like this is a perfect place for handling parameters-injection-at-rest, hovewer it doesn't looks like at this moment autowired is doing anything like this (unless i am missing something).
What i means is handling of the scenario below by passing PersonDAO from container
class Person(attributes: any, dao?: PersonDAO) {
}
const valeriy = new Person({name: 'valeriy'})
AutoWired replaces the original class constructor to avoid that new instances are created directly through the class constructor (without call the ioc container). I believe that it only makes sense if the scope used to manage the instances is diferent from Scope.Local. The library only includes the Local and Singleton scopes, but is possible to use a custom scope. An express application, for example, could use express-http-context to create a RequestScope,
Please could you explain or show a case why @AutoWired is meaningful except @Singleton?