First of all, you can set the config server that serve the config properties.
- Structure
- pom.xml
4.0.0 org.blog.test config-server-project 0.0.1-SNAPSHOT org.springframework.boot spring-boot-starter-parent 1.2.8.RELEASE UTF-8 1.8 org.springframework.boot spring-boot-starter-test org.springframework.cloud spring-cloud-config-server org.springframework.cloud spring-cloud-starter-parent Angel.SR4 pom import
- application.properties
server.port=8888 spring.profiles.active=native spring.cloud.config.server.native.searchLocations=file:C:\\workspace_eclipse\\config-server-project\\src\\main\\resources\\properties\\
- a-bootiful-client.properties
config.client.message=hello! Spring!!
- ConfigServiceApplication.java
package org.blog.test; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer; @EnableConfigServer @SpringBootApplication public class ConfigServiceApplication { public static void main(String[] args) { SpringApplication.run(ConfigServiceApplication.class, args); } }
You can find properties by using the url like this.
http://localhost:8888/a-bootiful-client/default
- result
original source : http://spring.io/guides/gs/centralized-configuration/
댓글 없음 :
댓글 쓰기