spring.thymeleaf配置编码出错

Field error in object ‘spring.thymeleaf’ on field ‘encoding’: rejected value [UTF-8 ]; codes [typeMismatch.spring.thymeleaf.encoding,typeMismatch.encoding,typeMismatch.java.nio.charset.Charset,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [spring.thymeleaf.encoding,encoding]; arguments []; default message [encoding]]; default message [Failed to convert property value of type [java.lang.String] to required type [java.nio.charset.Charset] for property ‘encoding’; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.nio.charset.Charset]]
at org.springframework.boot.bind.PropertiesConfigurationFactory.validate(PropertiesConfigurationFactory.java:362) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.bind.PropertiesConfigurationFactory.doBindPropertiesToTarget(PropertiesConfigurationFactory.java:271) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.bind.PropertiesConfigurationFactory.bindPropertiesToTarget(PropertiesConfigurationFactory.java:241) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:334) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
… 58 common frames omitted

原因:UTF-8后面有空格,导致无法识别编码

猜你喜欢

转载自blog.csdn.net/weixin_42388901/article/details/92600698