springCloud 和spring-boot 版本坑 之org.springframework.boot.builder.SpringApplicationBuilder.([Ljav

springCloud 在和spring-boot整合是,spring这边是版本号依赖的;否则会出错;

先来看下官网的版本对应关系:

 springCloud 和spring-boot 版本坑 之org.springframework.boot.builder.SpringApplicationBuilder.([Ljav_第1张图片

左边是spring-cloud 版本,右边是spring-boot版本;意思是比如你用了springCloud的greenwich版本,你的springboot版本必须是2.1.x版本,否则会报错;具体的报错信息如下:

12:21:56.781 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.([Ljava/lang/Class;)V
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:170)
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:104)
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:70)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:296)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
	at com.AppEureka.main(AppEureka.java:18)
Disconnected from the target VM, address: '127.0.0.1:56936', transport: 'socket'

所以大家在整合是一定要对应好版本号;

你可能感兴趣的:(Spring)