First, the documentation says all you need is to add the following:
This is not completely true as the following error occurs:
<dependency> <groupid>org.togglz</groupid> <artifactid>togglz-spring-boot-starter</artifactid> <version>2.6.1.Final</version> </dependency>
It appears you need to use the following dependency:
[ERROR] contextLoads Time elapsed: 0 s <<< ERROR! java.lang.NoClassDefFoundError: org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter
This makes the code compile without problems. Of course, I also need the console module, so I added:
<dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency>
This allowed me to have a working app with features enabled disabled. Very quickly I may add. Next was unto setting up a feature flag. This was very easy with the following properties:
<dependency> <groupid>org.togglz</groupid> <artifactid>togglz-console</artifactid> <version>2.6.1.Final</version> </dependency>
Notice that I had to change the configuration to also not use the management port. This is described here.
togglz.console.enabled=true togglz.console.path=/toggles togglz.console.secured=false togglz.console.use-management-port=false togglz.features.FAKE_JMS_LOAD.label=Fake JMS Load togglz.features.FAKE_JMS_LOAD.enabled=true
A few things I would like to see in future distributions:
- Given that Spring Boot is simple to use, I think we should be able to also add a way to add the Owner of a given toggle. This is not possible with the entries.
- In general, Togglz does not have a way to add more description to the flag. This would be super interesting as many features toggles can get lost.
In general, this seems like a good simple implementation of the "Feature Flag" pattern that provides a nice UI to non-technical folks to manage. It's definitely a great start, but I can see having the need to have more features.