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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.