1、加入依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
2、application.yml配置
server:
port: 10086
spring:
application:
name: eureka_server
eureka:
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://127.0.0.1:10086/eureka
3、引导类
/*声明为Eureka服务器*/
@EnableEurekaServer
@SpringBootApplication
public class Starter {
public static void main(String[] args) {
SpringApplication.run(Starter.class, args);
}
}
4、打开浏览器访问127.0.0.1:10086测试结果为:
``