开发者

How to inject String property in a spring bean

We inject simple property with configuration as shown below :

<bean id="myService" class="com.aaa.bbb.ccc.MyServiceImpl">
    <property name="myProp" value=""/>
</bean>

How would you do it with annotat开发者_运维知识库ions?


Using the @Value annotation. It supports SpEL as well, which means you can load a properties file and have @Value("${someConfigurationProperty}")

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜