Spring Boot Feature Manager not working

CareyBoldenow 96 Reputation points


I have a simple Spring Boot app that is currently using App Configuration and I am trying to extend that app to also use the "Feature Flag" capability in Azure App configuration. However, while everything seems to be wired up properly, the FeatureManager instance never seems to be able to find any of the feature flags I have enabled, so not sure what I am missing.

To start here is a screenshot of 2 feature flags I created in our app configuration resource:


Netx, here are some of the key files in my app.


<?xml version="1.0" encoding="UTF-8"?>  
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">    
    <!-- lookup parent from repository -->   
  <description>Demo project for Spring Boot</description>    




public class HelloController {  
    private static final Logger logger = LoggerFactory.getLogger(HelloController.class);  
    MessageProperties messageProperties;  
    FeatureManager featureManager;  
    public Response getMessage() {  
        logger.info("FEATURES: " + featureManager.getAllFeatureNames().size());  
        if (featureManager.isEnabledAsync("EnabledForStore").block()) {  
        } else {  
        Response response = new Response();  
        response.setMessage(messageProperties.getAppConfigTest() + " " + messageProperties.getResponseSuffix() + messageProperties.getResponseEnd());  
        return response;  

When I run the app and hit the controller, I always see that getAllFeatureNames returns an empty Set. Furthermore, I have never been able to return true for any of the features I have enabled. As I mentioned above, this same app is able to fetch key/value pairs from App Configuration so I know the connectivity is there, but no luck with the feature flags.

The other thing I would like to know is if we are able to namespace our feature flags by application. I know that we are forced to prefix all feature flags with .appconfig.featureflag/... but as you can see above, I have set the spring.application.name=myapp in the bootstrap.properties which then allows me to namespace/segment key/value pairs in app configuration by creating keys like /myapp/key1 and /myapp/key2. Can we do the same with feature flags? I created a feature flag with key of .appconfig.featureflag/myapp.foobar but I don't know if that will work given that I am unable to access any feature flags at this point. I guess in other words, if we want to use the same "named" feature flag in multiple apps, but enabled in some and not in others, how can we do that?

Any help with the above is greatly appreciated!

Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
188 questions
{count} votes

Accepted answer
  1. kobulloc-MSFT 14,746 Reputation points Microsoft Employee

    Thank you @CareyBoldenow for bringing this to our attention (and to Andy for working on the investigation)!

    Going through the tutorial Quickstart: Add feature flags to a Spring Boot app, flags were defaulting to false as a result of not being read successfully.

    In the bootstrap.properties file there were 2 lines that needed to be added:


    For the first line (feature-flags.enabled=true), the Azure SDK documentation lists the default value as false so this makes sense. The second line (feature-flags.label-filter=*) may not be a true requirement but it appears to be needed so a wildcard is used here.

    With these additions to the configuration, the "Beta" tab from the example application becomes visible:


    The feature name specified in code was the exact name of the App Configuration feature:




0 additional answers

Sort by: Most helpful