前言 大家肯定遇到过,如果读取配置文件中的中文会出现乱码的情况,尤其是使用@Value注解的时候 正文 解 我们配置文件中偶尔会出现中文,而我们的配置中往往会忽略编码的问题,需要增加 file-encoding=“UTF-8” <context:property-placeholder location="classpath:META-INF/spring/redis.properties" ignore-unresolvable="true" file-encoding="UTF-8"/>