1、spring cloud和spring boot 版本对应关系,https://start.spring.io/actuator/info
2、对eureka注册中心配置部分:
依赖包一定要选spring-cloud-starter-netflix-eureka-client,版本只要和spring-cloud版本对应起来即可,对应方式,只需要下载对应的spring-cloud依赖,然后看其pom中对应包的版本
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-eureka-client -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>3.0.5</version>
</dependency>
3、eureka配置文件:
spring:
application:
name: app-name
eureka:
client:
registerWithEureka: true #是否往注册中心注册自己
fetchRegistry: false #是否检索服务
serviceUrl:
defaultZone: http://ip:port/path,http://ip:port/path
#instance的配置作用是在eureka注册中心显示实例对应的具体ip和端口
instance:
prefer-ip-address: true
instance-id: ${spring.cloud.ip-address}:${server.port}
4、启动application增加注解:
@EnableDiscoveryClient
@EnableFeignClients
java冲突排查技巧:
[文件:MavenRunHelper.zip]