Spring Config uri
Spring Config uri
Define active_profile in bootstrap.yml
file
spring:
profiles:
active: ${activatedProperties}
Then create bootstrap-${activatedProperties}.yml
for each environment, etc..bootstrap-dev.yml
, bootstrap-pre.yml
, bootstrap-prod.yml
For example:
spring:
application:
name: servicename_prod
cloud:
config:
uri: https://admin:123456@test.com:8888
server:
port: 8443
add plugin to pom.xml
file :
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
When run java, define environment on it: for example, run with prod
environment.
java -Dserver.port=8443 -Dspring.profiles.active=prod -jar ....