Springboot 将 1.5.8 升级到 2.0 版本时出现异常“org.springframework.beans.factory.NoSuchBeanDefinitionException" [英] Springboot upgrade 1.5.8 to 2.0 release getting exception "org.springframework.beans.factory.NoSuchBeanDefinitionException"
问题描述
与 kubernetes 相关的 Gradle 依赖:
Gradle dependency related to kubernetes:
"io.fabric8:spring-cloud-kubernetes-core:0.1.6",
"io.fabric8:spring-cloud-starter-kubernetes:0.1.6",
"org.springframework.cloud:spring-cloud-starter-sleuth:1.2.4.RELEASE",
将 springboot 1.5.6 升级到 2.0.0.Release 时出现以下异常
Getting the below exception while upgrading springboot 1.5.6 to 2.0.0.Release
方法配置UpdateStrategy中的参数2io.fabric8.spring.cloud.kubernetes.reload.ConfigReloadAutoConfiguration$ConfigReloadAutoConfigurationBeans 需要一个无法找到的org.springframework.cloud.context.restart.RestartEndpoint"类型的 bean.
Parameter 2 of method configurationUpdateStrategy in io.fabric8.spring.cloud.kubernetes.reload.ConfigReloadAutoConfiguration$ConfigReloadAutoConfigurationBeans required a bean of type 'org.springframework.cloud.context.restart.RestartEndpoint' that could not be found.
Bean 方法restartEndpoint"未加载,因为@ConditionalOnClass 未找到所需的类org.springframework.integration.monitor.IntegrationMBeanExporter"
Bean method 'restartEndpoint' not loaded because @ConditionalOnClass did not find required class 'org.springframework.integration.monitor.IntegrationMBeanExporter'
未加载RestartEndpointWithoutIntegrationConfiguration"中的 Bean 方法restartEndpointWithoutIntegration",因为 @ConditionalOnEnabledEndpoint 发现属性 management.endpoint.restart.enabled 值为 false
Bean method 'restartEndpointWithoutIntegration' in 'RestartEndpointWithoutIntegrationConfiguration' not loaded because @ConditionalOnEnabledEndpoint found property management.endpoint.restart.enabled with value false
推荐答案
您可以执行以下任一操作,具体取决于您的要求:
You can do either of following, depending on your requirements:
如果不需要,请禁用
ConfigReloadAutoConfiguration
:
@SpringBootApplication(exclude = ConfigReloadAutoConfiguration.class)
public class SomeApplication {
...
}
将以下内容添加到您的 application.properties
中,正如错误消息所述:
Add the following into your application.properties
, just as the error message says:
management.endpoint.restart.enabled = true
这篇关于Springboot 将 1.5.8 升级到 2.0 版本时出现异常“org.springframework.beans.factory.NoSuchBeanDefinitionException"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!