spring cloud入门(二、注册中心)

1.在Intellij idea中创建spring cloud 注册中心,创建项目

2.下一步:

3.下一步,这里spring boot默认是2.0.3,创建完成后好像有问题,我后面修改配置文件将,版本修改为2.0.2

4.下一步,

5.完成。打开pom.xml。修改spring boot版本号。因为我的项目使用2.0.3.RELEASE版本有问题。如果您的没有问题可以不修改版本号。

6.在RegistryApplication.java,添加@EnableEurekaServer

7.修改配置文件。application.properties,修改为application.yml。添加以下内容。

server:
port: 8761
spring:
application:
name: registry
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka

8.启动项目,打开浏览器访问http://localhost:8761

posted @ 2018-06-21 10:53  微风吹过jy  阅读(174)  评论(0)    收藏  举报