Working with the template engine

We are enabling and disabling the fibonacci feature, but there are many other cases where the Feature Toggle can be very useful. One of them is hiding a web link that links to an unfinished feature. This is an interesting use because we can test what we released to production using its URL, but it will be hidden for the rest of the users for as long as we want.

To illustrate this behavior, we are going to create a simple web page using the already mentioned Thymeleaf framework.

First of all, we add a new control flag:

features: 
    fibonacci: 
        restEnabled: true 
        webEnabled: true 

Next, map this new flag in a configuration class:

 private boolean webEnabled; public boolean isWebEnabled() { return webEnabled; } public ...

Get Test-Driven Java Development - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.