Thymeleaf - Why can't I access templates on a spring-mvc application?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Thymeleaf - Why can't I access templates on a spring-mvc application?

I'm re-engineering an application and am moving slightly away from the automagically preconfigured spring-boot into a more spring-mvc based approach.

The project structure is shown in the picture:

All my Thymeleaf configuration is defined in a separate class:

public class ThymeleafConfiguration {

    public ServletContextTemplateResolver templateResolver() {
        ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
        return resolver;

    public SpringTemplateEngine templateEngine() {
        SpringTemplateEngine engine = new SpringTemplateEngine();
        return engine;

    public ThymeleafViewResolver thymeleafViewResolver() {
        ThymeleafViewResolver resolver = new ThymeleafViewResolver();
        return resolver;

My SecurityConfiguration class is defined as:

public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    // other methods and beans

    protected void configure(HttpSecurity http) throws Exception {
                .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))

Still, I get this error:

org.thymeleaf.exceptions.TemplateInputException: Error resolving template "login", template might not exist or might not be accessible by any of the configured Template Resolvers

I'm kind of lost here. What am I not seeing and how do I get this to work?

I have also posted this same message on stackoverflow, here: