详细错误:
1 23:36:21.161 [main] ERROR org.springframework.boot.SpringApplication - Application run failed 2 java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V 3 at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:161) 4 at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:102) 5 at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:68) 6 at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) 7 at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) 8 at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) 9 at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) 10 at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:76) 11 at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53) 12 at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:342) 13 at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) 14 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) 15 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) 16 at mgy.com.springboottest2.SpringbootTest2Application.main(SpringbootTest2Application.java:12) 17 Disconnected from the target VM, address: '127.0.0.1:63682', transport: 'socket' 18 19 Process finished with exit code 1
问题出现的原因:springboot的版本和springcloud的版本冲突了
解决方法:
之前是使用springboot的<version>2.1.7.RELEASE</version>对应springcloud的Edgware.RELEASE
应改为springboot的<version>2.1.7.RELEASE</version>对应springcloud的Greenwich.SR2