如题。
解决方案:
在applicationContext.xml中加入
<context:property-placeholder ignore-resource-not-found="true" location="classpath:inspectionConf/inspectionConf.properties" file-encoding="utf-8"/>
在要使用@Value的类名上方声明
@PropertySource(value = "classpath:a.properties")@Getter
使用时:
@Value("${worker}")
private String workers;
不再乱码。
另附五种读取配置文件的方式:http://www.cnblogs.com/hafiz/p/5876243.html