java - How to inject dependencies into a self-instantiated object in Spring? - Stack Overflow
You can also mark your MyClass with @Configurable annotation:
@Configurable public class MyClass { @Autowired private AnotherClass instance } Then at creation time it will automatically inject its dependencies. You also should have <context:spring-configured/> in your application context xml.
Read full article from java - How to inject dependencies into a self-instantiated object in Spring? - Stack Overflow
No comments:
Post a Comment