Skip to content

shankulk/spring-boot-feature-flagging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Feature Flagging in spring-boot

Demonstrates how to feature flag spring beans

What this application includes

There are three @Component spring beans viz.

  1. FeatureOne.java
  2. FeatureTwo.java
  3. FeatureThree.java

And an `application.yml` spring config file which has feature flags' values.

Note that all these components are annotated with `@ConditionalOnProperty` annotation.

Enabling features

Based on which feature should be enabled, set the value of feature flags in application.yml file.

Running the application

  1. Run ./gradlew bootRun on Mac/Linux or gradlew.bat bootRun on Windows terminal.
  2. On the console, verify that the enabled spring bean names are printed.

Important

All the three components extend from a base class Feature. This is not essential to create feature flagged beans. I created a common base class type for all these components so that it becomes easier for me to only fetch beans that I created for printing. See FeatureFlaggingApplication#printEnabledBeanNames() method to understand this.

About

Demonstrates how to feature flag spring beans

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages