Error creating bean with name ‘scopedTarget.eurekaClient‘ defined in class
Spring Cloud学习过程中遇到的Bug Error creating bean with name ‘scopedTarget.eurekaClient’ defined in class原因:在引入spring-cloud-starter-netflix-eureka-client和spring-boot-starter-web两个依赖的时候,会出现冲突。由于代码里面,我用了Spring
·
Spring Cloud学习过程中遇到的Bug Error creating bean with name ‘scopedTarget.eurekaClient’ defined in class
原因:
在引入spring-cloud-starter-netflix-eureka-client和spring-boot-starter-web两个依赖的时候,会出现冲突。由于代码里面,我用了Spring MVC的Rest方式,而没有用spring-cloud-starter-netflix-eureka-client本身包含Jesery Rest方式。导致出现下面的BUG。
解决办法:
在eureka依赖里面排除Jersey,用SpringMVC Rest方式
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<!-- 排除Jersey,用SpringMVC Rest方式-->
<exclusions>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-apache-client4</artifactId>
</exclusion>
</exclusions>
</dependency>
更多推荐
已为社区贡献1条内容
所有评论(0)