开发者

Adding Spring bean using annotations : placing it & initializing properties values

开发者 https://www.devze.com 2023-01-22 14:17 出处:网络
I\'ve gle开发者_Python百科aned that adding the context:component-scan will enable adding any jar with bean annotated as @Bean to the spring configuration, but , while getting lost in the Framework ref

I've gle开发者_Python百科aned that adding the context:component-scan will enable adding any jar with bean annotated as @Bean to the spring configuration, but , while getting lost in the Framework reference...

  • How can I add that bean as interceptor on specific channel?
  • How can bean properties be initialized if there's no element in the context.xml to specify them ? (such as String properties)

Thanks to all .... (it's spring framework 3.0.)


You need to use the @Value annotation to inject the value from a property coming from a property file or a -Dproperty

http://static.springsource.org/spring/docs/3.0.4.RELEASE/spring-framework-reference/html/new-in-3.html#new-java-configuration

0

精彩评论

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

关注公众号