我已经搜索了stackoverflow,阅读了文档,似乎无法获取我的@Value(" $ {myproperty.value}")给我除null之外的其他内容。
我有一些我在spring-servlet.xml中定义的bean以及属性文件。
<!-- Load properties files -->
<context:property-placeholder location="classpath:MyProperties.properties" ignore-unresolvable="true" />
加载属性文件时没有错误。在同一个xml中我定义了一个bean。
<bean id="pushNotification" class="com.mydomian.actions.MyClass"/>
在bean中我有使用@Value的属性。
private @Value("${some.property}") String propertyValue;
我的属性始终为null。
答案 0 :(得分:0)
您需要声明
<context:annotation-config />
启用注释处理。