标签:pac secure png ring framework pid com pre nat
<!-- 配置服务依赖 --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId> </dependency> <!-- Eureka 客户端依赖--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> </dependency>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
spring-cloud-dependencies 移至microservice中的pom文件
spring: profiles: active: native #配置服务器使用本地配置,默认git配置 application: name: micro-service-config # 在Eureka中注册的服务名 eureka: instance: non-secure-port: ${server.port:8763} # 环境变量中有值则使用环境变量中的值,如果没有的话默认8080端口 metadata-map: instanceId: ${spring.application.name}:${random.value} #配置在Eureka server中的ID client: service-url: defaultZone : http://localhost1:8761/eureka/,http://localhost2:8762/eureka/ #注册到Eureka Server
spring: cloud: config: server: native: search-locations: classpath:/config #配置文件所在位置 server: port: 8763
package com.nc.cloud.microservice.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication @EnableConfigServer //开启配置服务器的支持 @EnableEurekaClient // 开启 Eureka 客户端的支持 public class ConfigApplication { public static void main(String[] args) { SpringApplication.run(ConfigApplication.class, args); } }
Spring Boot 入门(四)微服务之 Config Server 统一配置中心
标签:pac secure png ring framework pid com pre nat
原文地址:http://www.cnblogs.com/ncjava/p/7151952.html