1、配置Eureka注册中心eureka-server,pom依赖如下:
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
2、Eureka Server实现代码,重点是其中的@EnableEurekaServer注解,后续博文会对设计注解的实现原理进行分析,本篇文章不涉及
@SpringBootApplication
@EnableEurekaServer
public class SpringbootdemoServerApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootdemoServerApplication.class, args);
}
}
3、Eureka Server配置文件:application.yml
<