I have a very simple question about Thymeleaf view engine.
Is it possible to execute a java method that add same context variable to a layout before it is loaded.
suppose that we want to load data from the database in our layout (exemple :notifications). I want to execute a code before loading a Thymeleaf layout page that will declare and add a context variable to the layout.
I know that I can load the variable from my controller but this is not a good solution giving that i have to load it in every page that need the layout.