Our Spring Java application should use Azure App Configuration service to manage feature flags.
The problem is that there is no way to run App Configuration service locally through Docker like other feature flags manager products. There is an option the Java Azure SDK to use local configuration but it is not clear how I can mix it with server configuration. What I would like to have something like this:
1. Spring local/test profile to use file configuration. Developer to control everything.
2. Any other profiles to use remote Azure App Configuration service.
When I add spring-cloud-azure-appconfiguration-config-web
dependency Java application start trying to connect to the server and the file configuration is ignored.
<!-- Global: take feature flags form the server -->
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-appconfiguration-config-web</artifactId>
</dependency>
<!-- Local -->
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-feature-management-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
Obviously there is not meant to work together without any additional configuration.
Could you tell me please is it possible such kind of configuration? Is there some magic properties that I can use? May be there is another way to organise local and qas/prod environments. Please advice.
There are a few ways this can work depending on what you need, all of them use Spring Profiles.
If you need app configuration, but not feature flags from App Configuration you can just disable loading of feature flags spring.cloud.azure.appconfiguration.stores[0].feature-flags.enabled=false
, which is the default value.
You can disable all of app configuration then it will not attempt to load anything with spring.cloud.azure.appconfiguration.enabled=false
This doc has all the options. https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/spring-cloud-azure-starter-appconfiguration-config#supported-properties
And Really anything else you might need to know: https://learn.microsoft.com/azure/developer/java/spring-framework/app-configuration-support
Just make sure you have your local spring configuration in different files for each of your profiles. i.e. bootstrap-local.properties
, so just your local properties are loaded when you are using your local profile.