开发者

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜