图 创建新项目自定义引用
如果改造原有项目,在POM中增加:
org.springframework.cloud
spring-cloud-config-server
org.springframework.cloud
spring-cloud-starter-config
2.2 在propertities设置服务端口和服务名称
spring.application.name=cfs-server
server.port=9999
2.3 设置配置文件的引用规则(相对路径、GIT、绝对路径,演示采用的是相对路径)
spring.profiles.active=native
spring.cloud.config.server.native.searchLocations=classpath:/properties/
2.4
加入用于客户端使用的配置文件,由于是相对路径,在项目的resources中增加了个propertities的文件夹,里面加入了个配置文件供客户端使用。配置文件的命名规则
{应用名}-{配置文件名}