spring-cloud-netflix-eureka-client integrated springboot startup error

java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.([Ljava/lang/Object;)V

If you have encountered such a problem when building a springboot project, then this problem is a version compatibility problem.
There is another situation that is about binding. Prompt binder failed, the problem is probably similar.
This problem has bothered me for a long time. I suddenly encountered this problem when I set up the report project last Friday, so I went back to study on Saturday and Sunday, and I also referred to some blogs about this convenient solution. In the end, the problem was solved through multiple attempts and analysis of my own.

 <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-netflix-eureka-client</artifactId>
        </dependency>

There is no need to specify the version number when importing the registry jar package. Because the two jar versions are difficult to be compatible when springboot and eureka are integrated. So we have to let the system match by itself. So how does the system automatically adapt itself?

   <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Finchley.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
  • Join the above content system to automatically match.

I used springboot 2.1.5.RELEASE and deleted the local warehouse. After reinstalling, I found that the warehouse was using 2.0.0. The startup project is normal!

expand

So what is the specific problem?

spirngcloud version evolution process

Version name Version
Finchley snapshot version
Edgware snapshot version
Dalston SR1 Current latest stable version
Camden SR7 stable version
Brixton SR7 stable version
Angel SR6 stable version

Springboot and springCloud version matching relationship

Finchley is compatible with Spring Boot 2.0.x, not compatible with Spring Boot 1.5.x
Dalston and Edgware are compatible with Spring Boot 1.5.x, not compatible with Spring Boot 2.0.x
Camden is compatible with Spring Boot 1.4.x, and also compatible with Spring Boot 1.5.x
Brixton is compatible with Spring Boot 1.3.x, also compatible with Spring Boot 1.4.x
Angel is compatible with Spring Boot 1.2.x

So we can use Springboot 2.0 normally by configuring FINchley. If your springboot version is 1.x,
then you can try it with Brixton.

Guess you like

Origin blog.csdn.net/qq_39809613/article/details/108875632