@Value读取配置文件,中文字符乱码

如题。

解决方案:

在applicationContext.xml中加入

   


在要使用@Value的类名上方声明

@PropertySource(value = "classpath:a.properties")
@Getter


使用时:

@Value("${worker}")
 private String workers;


不再乱码。


另附五种读取配置文件的方式:http://www.cnblogs.com/hafiz/p/5876243.html

你可能感兴趣的:(@Value读取配置文件,中文字符乱码)