1.打开idea,点击file-->new-->module;
2.选择springboot initializr,选择jdk版本,点击next
3.选择spring cloud Discovery,选择Spring Boot版本,选择Eureka Server,点击Finish
4.启动类添加@EnableEurekaServer注解
5.修改application.properties文件
server:
port: 8761
eureka:
instance:
hostname: 127.0.0.1
client:
register-with-eureka: false
fetch-registry: false
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://{eureka.instance.hostname}:{server.port}/eureka/
6.启动项目