Currently registering a view controller requires a configuration class to be registered that implements WebMvcConfigurer. One needs to override …. addViewControllers(…) and usually adds lines like:

registry.addViewController("/login").setViewName("login");

This feels like quite a bit of boilerplate to register a URI to view name mapping. Especially if the URI is identical to the template name.

I've run into this trying to override the login form provided by Spring Security by default. Not sure I've overseen a simpler mechanism to tweak that but it seemed quite a bit of framework falling into my face for a pretty straight forward task of having a custom login template.

In case you think this is a too broad brush, I also wondered whether it'd make sense to establish a convention for a custom form login template location, so that simply placing a well-named template in a well-known location would tweak the MVC setup accordingly. This of course has other side effects, too, potentially affecting existing applications.

Comment From: wilkinsona

There's some code in Sagan that does something in this area: https://github.com/spring-io/sagan/blob/394a9f0922e19fbfb40c15c8639ca885f1dc2d03/sagan-site/src/main/java/sagan/MvcConfig.java#L63-L78