从1.5迁移到2.0后,我收到以下错误。
***************************
APPLICATION FAILED TO START
***************************
Description:
Binding to target [Bindable@7178d811 type = org.springframework.boot.autoconfigure.web.ServerProperties, value = 'provided', annotations = array<Annotation>[[empty]]] failed:
Property: server
Value:
Origin: "server" from property source "class path resource [application.yml]"
Reason: No converter found capable of converting from type [java.lang.String] to type [org.springframework.boot.autoconfigure.web.ServerProperties]
Action:
Update your application's configuration
运行现有的Junit测试后,我得到如下错误:
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:107)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:44)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:242)
at com.nmj.cloud.api.RestfulCommandServiceTest.setUp(RestfulCommandServiceTest.java:917)
。。。。
Caused by: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatServletWebServerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serverPropertiesWebServerFactoryCustomizer' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfiguration.class]: Unsatisfied dependency expressed through method 'serverPropertiesWebServerFactoryCustomizer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'server-org.springframework.boot.autoconfigure.web.ServerProperties': Could not bind properties to 'ServerProperties': prefix=server, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'server' to org.springframework.boot.autoconfigure.web.ServerProperties
。。。。
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatServletWebServerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serverPropertiesWebServerFactoryCustomizer' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfiguration.class]: Unsatisfied dependency expressed through method 'serverPropertiesWebServerFactoryCustomizer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'server-org.springframework.boot.autoconfigure.web.ServerProperties': Could not bind properties to 'ServerProperties': prefix=server, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'server' to org.springframework.boot.autoconfigure.web.ServerProperties
。。。。
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serverPropertiesWebServerFactoryCustomizer' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfiguration.class]: Unsatisfied dependency expressed through method 'serverPropertiesWebServerFactoryCustomizer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'server-org.springframework.boot.autoconfigure.web.ServerProperties': Could not bind properties to 'ServerProperties': prefix=server, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'server' to org.springframework.boot.autoconfigure.web.ServerProperties
。。。。
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'server-org.springframework.boot.autoconfigure.web.ServerProperties': Could not bind properties to 'ServerProperties': prefix=server, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'server' to org.springframework.boot.autoconfigure.web.ServerProperties
。。。。
Caused by: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'server' to org.springframework.boot.autoconfigure.web.ServerProperties
。。。。
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [org.springframework.boot.autoconfigure.web.ServerProperties]
。。。。
application.yml如下所示: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
spring:
resources:
add-mappings: false
mvc:
throw-exception-if-no-handler-found: true
autoconfigure.exclude:
- org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration
- org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration
- org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
- org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
- org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration
- org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
- org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
- org.springframework.boot.autoconfigure.data.RedisRepositoriesAutoConfiguration
- org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration
mock:
id: 1314
authentication:
jwt:
publickey: /pubkey.pem
analyze:
url: http://localhost:8000/analyze
server:
error:
path: /error
restTemplate:
connectTimeout: 2000
readTimeout: 2000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
我不知道如何更新应用程序的配置。有人可以给我一些解决这个问题的建议吗?
答案 0 :(得分:3)
这是Spring Boot中的一个错误,请查看#10945以获取更新。
答案 1 :(得分:0)
这个问题有解决方案吗?从 SpringBoot 1.x 升级到 2.5 后出现同样的问题
implementation 'org.togglz:togglz-spring-boot-starter:2.9.7'
implementation 'org.togglz:togglz-console:2.9.7
启动应用程序时出错...
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'togglz.features.getnextovertime' to org.togglz.spring.boot.actuate.autoconfigure.TogglzProperties$FeatureSpec:
Reason: No converter found capable of converting from type [java.lang.String] to type [org.togglz.spring.boot.actuate.autoconfigure.TogglzProperties$FeatureSpec]
Action:
Update your application's configuration