No META-INF/validation.xml found. Using annotation based configuration only

错误信息如下

[main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.([Ljava/lang/Object;)V
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:157)
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:98)
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:64)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
Disconnected from the target VM, address: '127.0.0.1:62475', transport: 'socket'
	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:127)
	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:358)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:317)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
	at com.yunfei.EurekaServiceH2Application.main(EurekaServiceH2Application.java:40)

Process finished with exit code 1

 其根本原因是依赖包的版本冲突,我的这个pom.xml文件如下:

解决前pom文件为



	4.0.0

	com.zntg
	service-shedulg-subscribe-book
	0.0.1-SNAPSHOT
	jar

	service-feign
	Demo project for Spring Boot
	
		org.springframework.boot
		spring-boot-starter-parent
		2.0.0.RELEASE
		 
	

	
		UTF-8
		UTF-8
		1.8
		Finchley.RELEASE
	

	
		
			org.springframework.cloud
			spring-cloud-starter-hystrix
		
		
			org.springframework.cloud
			spring-cloud-starter-eureka
		
		
			org.springframework.cloud
			spring-cloud-starter-feign
		
		
			org.springframework.boot
			spring-boot-starter-web
		

		
			org.springframework.boot
			spring-boot-starter-test
			test
		
		
			org.mybatis.spring.boot
			mybatis-spring-boot-starter
			1.3.1
		
		
			myojdbc6
			aaa
			1.0
			aaa
		
	

	
		
			
				org.springframework.cloud
				spring-cloud-dependencies
				Dalston.RC1
				pom
				import
			
		
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
			
		
	
	
		
			spring-milestones
			Spring Milestones
			https://repo.spring.io/milestone
			
				false
			
		
		
			
				true
			
			
				true
			
			nexus
			http://10.0.100.210:8081/nexus/content/repositories/thirdparty/
		
		
			nexus-aliyun
			nexus-aliyun
			http://maven.aliyun.com/nexus/content/groups/public/
			
				true
			
			
				false
			
		
	


 解决后pom文件为



	4.0.0

	com.zntg
	service-shedulg-subscribe-book
	0.0.1-SNAPSHOT
	jar

	service-feign
	Demo project for Spring Boot
	
		org.springframework.boot
		spring-boot-starter-parent
		1.5.3.RELEASE
		 
	

	
		UTF-8
		UTF-8
		1.8
		Finchley.RELEASE
	

	
		
			org.springframework.cloud
			spring-cloud-starter-hystrix
		
		
			org.springframework.cloud
			spring-cloud-starter-eureka
		
		
			org.springframework.cloud
			spring-cloud-starter-feign
		
		
			org.springframework.boot
			spring-boot-starter-web
		

		
			org.springframework.boot
			spring-boot-starter-test
			test
		
		
			org.mybatis.spring.boot
			mybatis-spring-boot-starter
			1.3.1
		
		
			myojdbc6
			aaa
			1.0
			aaa
		
	

	
		
			
				org.springframework.cloud
				spring-cloud-dependencies
				Dalston.RC1
				pom
				import
			
		
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
			
		
	
	
		
			spring-milestones
			Spring Milestones
			https://repo.spring.io/milestone
			
				false
			
		
		
			
				true
			
			
				true
			
			nexus
			http://10.0.100.210:8081/nexus/content/repositories/thirdparty/
		
		
			nexus-aliyun
			nexus-aliyun
			http://maven.aliyun.com/nexus/content/groups/public/
			
				true
			
			
				false
			
		
	


 另外一种方法是不降低springclould的版本

 将springclould和eureka2个微服务的版本保持一致

核心是这一行

	Finchley.RELEASE

 

完整的pom文件为



	4.0.0

	com.zntg
	service-shedulg-subscribe-book
	0.0.1-SNAPSHOT
	jar

	service-shedulg-subscribe-book
	Demo project for Spring Boot
	
		org.springframework.boot
		spring-boot-starter-parent
		2.0.3.RELEASE
		 
	

	
		1.2.24
		1.0.9
		UTF-8
		UTF-8
		1.8
		Finchley.RELEASE
	

	
		
			org.springframework.cloud
			spring-cloud-starter-hystrix
			1.4.6.RELEASE
		
		
			org.springframework.cloud
			spring-cloud-starter-eureka
			1.4.6.RELEASE
		
		
			org.springframework.cloud
			spring-cloud-starter-feign
			1.4.6.RELEASE
		
		
			org.springframework.boot
			spring-boot-starter-web
		

		
			org.springframework.boot
			spring-boot-starter-test
			test
		
		
			org.mybatis.spring.boot
			mybatis-spring-boot-starter
			1.3.1
		
		
			myojdbc6
			aaa
			1.0
			aaa
		
		
		
			org.springframework.boot
			spring-boot-starter-jdbc
		
		
			com.alibaba
			druid
			${druid.version}
		
		
			com.alibaba
			fastjson
			${fastjson.version}
		


	

	
		
			
				org.springframework.cloud
				spring-cloud-dependencies
				
				Finchley.RELEASE
				pom
				import
			
		
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
			
		
	
	
		
			spring-milestones
			Spring Milestones
			https://repo.spring.io/milestone
			
				false
			
		
		
			
				true
			
			
				true
			
			nexus
			http://10.0.100.210:8081/nexus/content/repositories/thirdparty/
		
		
			nexus-aliyun
			nexus-aliyun
			http://maven.aliyun.com/nexus/content/groups/public/
			
				true
			
			
				false
			
		
	


 启动可以正常运行

你可能感兴趣的:(No META-INF/validation.xml found. Using annotation based configuration only)