Member-only story
Togglz: Seamless Feature Rollouts in Spring Boot Apps
A comprehensive guide to simplifying feature rollouts without redeployment using the Togglz library

Feature Toggle is a design pattern that allows you to enable new features during runtime. The benefit of this strategy is that you can control the feature rollout independently from the deployment process.
You can release the feature for a certain period or show it to specific users. This way, you get quick feedback if the new code is working as expected before releasing it to all users in production.
In this article, I’ll show you how to use the Togglz library in a Spring Boot application to enable features during runtime.
Let’s get started!
Demo Project
Togglz is an open-source library that implements the Feature Toggle design pattern. Each new feature can be associated with a toggle.
Let’s create a new Spring Boot project to see how to integrate the library.
Project dependencies
I’ll use Maven as a build tool for this demo.
We need the following dependencies for the pom.xml
file:
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-spring-boot-starter</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-console</artifactId>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>3.0.4</version>
</dependency>
- Spring boot provides a starter package
togglz-spring-boot-starter
that includes the Togglz features. togglz-console
enables an Admin Console for feature control over the UI.- We need the
spring-boot-starter-actuator
to access the application endpoints, including Togglz.
Configure the feature toggles
You can define the feature toggles either in Java code as enums or in the application.yml
file.