The @Configuration classes should provide way for manually creating the components in the DI container. This is really important especally for instances of classes which cannot be decorated with @Component and picked-up by the @ComponentScan.
Goal
Add support for creating components from the methods in @Configuration classes decorated with @Component similar like Spring. For more info check the Spring documentation on configuration classes (Link).
Task
Extend @Component decorator so it can be used also on methods in @Configuration classes
Implementation detail: TypeScript has few types of decorators depending on the place where they are used. They can be differentiated by the arguments that are passed to the decorator function. That means that we can create a universal decorator that can be used on all places. In this patch I wrote a small util that can infer the decorator type from it's arguments.
Note:
@Inject and @Value should also work in @Configuration classes -> in that way we can get the dependencies from imported configuration classes
@Configuration class needs to be proxied in order to respect the component scope -> local dependencies will be fetched by calling the component definition method
Background
The @Configuration classes should provide way for manually creating the components in the DI container. This is really important especally for instances of classes which cannot be decorated with @Component and picked-up by the @ComponentScan.
Goal
Add support for creating components from the methods in @Configuration classes decorated with @Component similar like Spring. For more info check the Spring documentation on configuration classes (Link).
Task
Extend @Component decorator so it can be used also on methods in @Configuration classes
Implementation detail: TypeScript has few types of decorators depending on the place where they are used. They can be differentiated by the arguments that are passed to the decorator function. That means that we can create a universal decorator that can be used on all places. In this patch I wrote a small util that can infer the decorator type from it's arguments.
Note: