弹簧属性注入不适用于@Value和<util:properties>

问题描述

|| 我在使用Spring的类中注入属性时遇到问题。 我的applicationContext.xml包含以下内容:
<context:annotation-config />
<context:component-scan base-package=\"life\" />
<util:properties id=\"config\" location=\"classpath:config/files/config.properties\"/>
例如,我想在config.properties文件中获取一个布尔值:
package life.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class LifePath {

    private @Value(\"#{config.production_mode}\")static boolean prodMode;
我没有错误,但是那没用。 如果有人有帮助我的想法,那就太好了。 约翰     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)