我正在使用弹簧加载属性文件
<bean id="appProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="classpath:/sample.properties" />
<property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>
当我使用
@Value("${testkey}")
它工作正常。
但是当我尝试使用 env
@Resource
private Environment environment;
environment.getProperty("testkey") // returning null