天天看點

IDEA手把手搭建Eureka Server執行個體

springcloud官方文檔位址:

http://cloud.spring.io/spring-cloud-static/Greenwich.SR1/single/spring-cloud.html

1.IDEA建立Spring項目

IDEA手把手搭建Eureka Server執行個體
IDEA手把手搭建Eureka Server執行個體

勾選eureka server需要的maven依賴,根據官方文檔

IDEA手把手搭建Eureka Server執行個體

然後點選下一步,點選finish完成項目。

啟動類添加@EnableEurekaServer注解

IDEA手把手搭建Eureka Server執行個體

編寫properties.yml檔案  參考官方文檔(12.4 Standalone Mode)

server:
  port: 8761

eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/      

運作項目,通路http://localhost:8671,出現控制台頁面,即EurekaServer服務搭建成功。

IDEA手把手搭建Eureka Server執行個體

繼續閱讀