下一步->選擇cloud discovery->eureka server ,而後一直下一步就好了。spring
2.3 啓動一個服務註冊中心,只須要一個註解@EnableEurekaServer,這個註解須要在springboot工程的啓動application類上加:springboot
@EnableEurekaServer @SpringBootApplication public class EurekaserverApplication { public static void main(String[] args) { SpringApplication.run(EurekaserverApplication.class, args); } }
application.propertiesapp
server.port = 8761 eureka.instance.hostname=localhost eureka.client.registerWithEureka=false eureka.client.fetchRegistry=false eureka.client.serviceUrl.defaultZone = http://${eureka.instance.hostname}:${server.port}/eureka/
經過eureka.client.registerWithEureka:false和fetchRegistry:false來代表本身是一個eureka server.fetch