page_type | languages | products | name | description | ||
---|---|---|---|---|---|---|
sample |
|
|
Managing Features and Get Configurations From App Configuration in Spring Boot Web Application |
This sample demonstrates how to manage features and how to get configurations from App Configuration to Spring Environment in Spring Boot web application. |
Manage features with targeting filter and get configurations from App configuration in Spring Boot web application
This sample describes how to use spring-cloud-azure-feature-management to manage features with targeting filter.
Start the application and check the resulting tab in a browser window.
- Load features from application.yml
mvn spring-boot:run
- Open a browser window, and go to the URL: http://localhost:8080/welcome
3. Set parameter: http://localhost:8080/welcome?userId=Jeff and refresh the browser page to see the new configuration settings
-
Create a Configuration Store if not exist.
-
Import the data file src/main/resources/data/sample-data.yml into the App configuration store created above. Under
For language
selectOther
. UnderFile type
selectYaml
.
Change the connection-string value with the Access Key value of the App configuration store created above.
Start the application and access http://localhost:8080/welcome with different parameters to check the returned tab. 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.
Now that you have the Spring Boot application running locally, it's time to move it to production. Azure Spring Apps makes it easy to deploy Spring Boot applications to Azure without any code changes. The service manages the infrastructure of Spring applications so developers can focus on their code. Azure Spring Apps provides lifecycle management using comprehensive monitoring and diagnostics, configuration management, service discovery, CI/CD integration, blue-green deployments, and more. To deploy your application to Azure Spring Apps, see Deploy your first application to Azure Spring Apps.