java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V
Let me first tell you how I reported this error:
When working on a new microservice project, this error was reported when starting eureka and a service;
I checked a lot on the Internet, but they all said that the springcloud and springboot versions do not correspond; - Let me explain, it is probably a problem with this version, let's take a look at the version I am using here first!
- springboot:2.1.10.RELEASE
- springcloud:Greenwich.SR4
- JDK1.8
I checked online and found that this version corresponds to the correct version; you can refer to this blog post for the corresponding version numbers of the two: Detailed version of the version correspondence between SpringBoot and SpringCloud
The error is reported as follows:
After working on the version number in the pom file for a long time, it still prompted that there was a problem with the version; then after several hours of searching for the problem (a bit disgusting), I found that there was a "runtime" in my total pom.xml file:
Change it to "import" and no error will be reported:
Compile - Start successfully: This is a problem with my own project. I checked the functions of "import" and "runtime" online.
-
<scope>runtime</scope>
refers to the packages required directly at runtime, rather than packages required at compile time, etc. -
<scope>import</scope>
The current dependency is copied by reference and is not affected by single inheritance.
Hope it helps you