Spring Could Config Server native profile
important
spring:
profiles:
active:
- native
build, run and test
bash gradlew clean assemble composeUp
# do some..
bash gradlew composeDown
fetch configs from config-server using REST API
# http :8888/{application}/{profile}[/{label}]
# http :8888/{application}-{profile}.yml
# http :8888/{label}/{application}-{profile}.yml
# http :8888/{application}-{profile}.properties
# http :8888/{label}/{application}-{profile}.properties
http :8888/mq-default.yml
HTTP/1.1 200
Content-Length: 83
Content-Type: text/plain
Date: Sun, 24 Sep 2017 18:39:02 GMT
X-Application-Context: application:native,rabbitmq:8888
mq:
password: guest
server:
host: 0.0.0.0
port: 5672
username: guest
http :8888/db-default.properties
HTTP/1.1 200
Content-Length: 106
Content-Type: text/plain
Date: Sun, 24 Sep 2017 18:38:26 GMT
X-Application-Context: application:native,rabbitmq:8888
db.name: postgres
db.password: postgres
db.server.host: 0.0.0.0
db.server.port: 5432
db.username: postgres
http :8888/db/default
HTTP/1.1 200
Content-Type: application/json;charset=UTF-8
Date: Sun, 24 Sep 2017 18:39:40 GMT
Transfer-Encoding: chunked
X-Application-Context: application:native,rabbitmq:8888
{
"label": null,
"name": "db",
"profiles": [
"default"
],
"propertySources": [
{
"name": "classpath:/config/db.yml",
"source": {
"db.name": "${$DB_NAME:postgres}",
"db.password": "${$DB_PASSWORD:postgres}",
"db.server.host": "${$DB_SERVER_HOST:0.0.0.0}",
"db.server.port": "${$DB_SERVER_PORT:5432}",
"db.username": "${$DB_USERNAME:postgres}"
}
}
],
"state": null,
"version": null
}
http :8888/db/dev
HTTP/1.1 200
Content-Type: application/json;charset=UTF-8
Date: Sun, 24 Sep 2017 19:46:57 GMT
Transfer-Encoding: chunked
X-Application-Context: application:native:8888
{
"label": null,
"name": "db",
"profiles": [
"dev"
],
"propertySources": [
{
"name": "classpath:/config/db-dev.yml",
"source": {
"db.name": "postgres}",
"db.password": "postgres}",
"db.server.host": "127.0.0.1",
"db.server.port": 5432,
"db.username": "postgres}"
}
},
{
"name": "classpath:/config/db.yml",
"source": {
"db.name": "${$DB_NAME:postgres}",
"db.password": "${$DB_PASSWORD:postgres}",
"db.server.host": "${$DB_SERVER_HOST:0.0.0.0}",
"db.server.port": "${$DB_SERVER_PORT:5432}",
"db.username": "${$DB_USERNAME:postgres}"
}
}
],
"state": null,
"version": null
}
http :8888/mq-dev.yml
HTTP/1.1 200
Content-Length: 85
Content-Type: text/plain
Date: Sun, 24 Sep 2017 19:49:45 GMT
X-Application-Context: application:native:8888
mq:
password: guest
server:
host: 127.0.0.1
port: 5672
username: guest