This sample describes how to use spring-cloud-feature-management to manage features and how to get configurations from App Configuration Service to Spring Environment.
Start the application and check the resulting console output to check the returned value.
- Load features from application.yml
mvn spring-boot:run
- Check the returned value. The feature
Beta
has one filterRandom
which defines
-
Create a Configuration Store if not exist.
-
Import the data file src/main/resources/data/sample-data.json into the Configuration Store created above. Under
For language
selectOther
. UnderFile type
selectYaml
.
Change the connection-string value with the Access Key value of the Configuration Store created above.
Start the application and access http://localhost:8080 to check the returned value. Different commands for different scenarios are listed below.
- Load properties similar with from application.properties, i.e., keys starting with /application/
mvn spring-boot:run
- Load properties similar with from application_dev.properties, i.e., keys starting with /application_dev
mvn -Dspring.profiles.active=dev spring-boot:run
- Load properties similar with from foo.properties, i.e., keys starting with /foo/
mvn -Dspring.application.name=foo spring-boot:run
- Load properties similar with from foo_dev.properties, i.e., keys starting with /foo_dev/
mvn -Dspring.application.name=foo -Dspring.profiles.active=dev spring-boot:run
Please refer to this README about more usage details.