Spring Boot 错误原因:java.lang.非法参数异常:无法示例化接口BootstrapRegistryInitialize:配置客户端重试引导程序

zdwk9cvp  于 2022-11-29  发布在  Spring
关注(0)|答案(1)|浏览(437)

I am currently getting this exception, can someone help please.
I am using the following versions: spring-boot-starter-parent: 2.7.0 spring-cloud-starter-bootstrap: 3.1.3 spring-cloud-dependencies: 2021.0.3
I started getting this exception when I added this maven dependency

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
            <version>3.1.3</version>
        </dependency>

Exception :
Caused by: java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.boot.BootstrapRegistryInitializer : org.springframework.cloud.config.client.ConfigClientRetryBootstrapper at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:449) at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:431) at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:424) at org.springframework.boot.SpringApplication.(SpringApplication.java:266) at org.springframework.boot.builder.SpringApplicationBuilder.createSpringApplication(SpringApplicationBuilder.java:129) at org.springframework.boot.builder.SpringApplicationBuilder.(SpringApplicationBuilder.java:102) at org.springframework.boot.builder.SpringApplicationBuilder.(SpringApplicationBuilder.java:98) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createSpringApplicationBuilder(SpringBootServletInitializer.java:166) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:130) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97) at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5221) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ... 44 more Caused by: java.lang.IllegalArgumentException: class org.springframework.cloud.config.client.ConfigClientRetryBootstrapper is not assignable to interface org.springframework.boot.BootstrapRegistryInitializer at org.springframework.util.Assert.assignableCheckFailed(Assert.java:720) at org.springframework.util.Assert.isAssignable(Assert.java:651) at org.springframework.util.Assert.isAssignable(Assert.java:682) at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:443)
I am upgrading to spring 2.7.0 do i need to also upgrade all the Managed Dependencies mentioned in https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/2.7.0 in my project also ?

bjp0bcyl

bjp0bcyl1#

在我看来,这个问题可能是版本冲突,我建议您在构建文件中添加最新版本的Spring云依赖项。

dependencyManagement {
    imports {
    mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.5"
    }
}

对我来说,这解决了问题,
模拟问题:Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener

相关问题