Using springs component-scan and injecting beans
Im using spring 2.5 and writing a DispatcherServlet. In the context file for the servlet im using component-s开发者_如何学Pythoncan and giving the location of the class where my controllers are. The classes use the @Controller("bean Name") annotation.
How can i inject properties into this bean?
Thanks
Also remember that you can inject beans defined in main application context to the beans defined in application context for servlet, but not vice-versa. These contexts aren't merged, but they form parent-child relationship.
Using @Autowired
(docs) or @Resource
(docs).
精彩评论