为了账号安全,请及时绑定邮箱和手机立即绑定

freemarker页面启动无法访问

2018-12-09 15:01:40.575  WARN 9784 --- [  restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'viewResolver' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration$FreeMarkerWebConfiguration': Unsatisfied dependency expressed through field 'properties': Error creating bean with name 'spring.freemarker-org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties': Could not bind properties to FreeMarkerProperties (prefix=spring.freemarker, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is org.springframework.validation.BindException: org.springframework.boot.bind.RelaxedDataBinder$RelaxedBeanPropertyBindingResult: 1 errors

Field error in object 'spring.freemarker' on field 'charset': rejected value [UTF-8 ]; codes [typeMismatch.spring.freemarker.charset,typeMismatch.charset,typeMismatch.java.nio.charset.Charset,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [spring.freemarker.charset,charset]; arguments []; default message [charset]]; default message [Failed to convert property value of type [java.lang.String] to required type [java.nio.charset.Charset] for property 'charset'; 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]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.freemarker-org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties': Could not bind properties to FreeMarkerProperties (prefix=spring.freemarker, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is org.springframework.validation.BindException: org.springframework.boot.bind.RelaxedDataBinder$RelaxedBeanPropertyBindingResult: 1 errors

Field error in object 'spring.freemarker' on field 'charset': rejected value [UTF-8 ]; codes [typeMismatch.spring.freemarker.charset,typeMismatch.charset,typeMismatch.java.nio.charset.Charset,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [spring.freemarker.charset,charset]; arguments []; default message [charset]]; default message [Failed to convert property value of type [java.lang.String] to required type [java.nio.charset.Charset] for property 'charset'; 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]]

2018-12-09 15:01:40.585  INFO 9784 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service Tomcat

2018-12-09 15:01:40.608  INFO 9784 --- [  restartedMain] utoConfigurationReportLoggingInitializer : 


Error starting ApplicationContext. To display the auto-configuration report enable debug logging (start with --debug)



2018-12-09 15:01:40.625 ERROR 9784 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 


***************************

APPLICATION FAILED TO START

***************************


正在回答

2 回答

报错信息里面已经说了,是在配置spring.freemarker的charset属性出错了,无法将UTF-8进行转换,但是属性和值应该都没问题,你检查一下你的UTF-8后面是不是有个空格,多了这个空格,就会导致无法识别编码,properties文件的=后面的值,前面可以加空格,但是后面千万不能乱加空格

0 回复 有任何疑惑可以回复我~

是不是在application.properties里面的配置有误

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

freemarker页面启动无法访问

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信