I am trying to set a default model value for all of my controllers, which is interpreted by my HTML template's layout (this is to add a top banner to all pages, such as to warn about upcoming maintenance). I wrote an @ControllerAdvice
class with an @ModelAttribute
method, and this works correctly on all of my custom controllers.
However, it does nothing when I visit a mapping registered directly with the ViewControllerRegistry
; the method is simply never called, and ParameterizableViewController
seems to bypass the normal binding and model generation.
Is there a way to write advice that will get applied to view controllers as well as custom controllers?