Eclipse环境下Spring Boot配置文件乱码问题解决方案

第一步:Eclipse中进行如下菜单设置:

Window - Preferences - General - Content Types,右侧Text - java Properites File 在Default encoding中输入UTF-8,点击Update。

如果自定义配置文件未更新编码格式,可在属性中手动设置为utf-8。

另外,读取配置文件时,自定义配置文件类中@PropertySource注解中也可指明编码格式。如下:

@PropertySource(value= {"classpath:config.properties"},encoding="UTF-8")

猜你喜欢

转载自blog.csdn.net/xiami_17_pangdun/article/details/89190587