Q:

Spring Boot templates not resolved

I'm trying to build a standalone web application using Spring Boot and Thymeleaf. The application runs fine from IntelliJ IDEA, but I'm not able to run the jar on its own. Apparently the templates are not included.
My project is structured as follows:
├── src
│   └── main
│       ├── java
│       │   └── my
│       │       └── domain
│       │           └── application
│       │               ├── domain
│       │               ├── service
│       │               ├── web
│       │               ├── ApplicationConfig.java
│       │               ├── SecurityConfig.java
│       │               ├── ThymeleafConfig.java
│       │               └── WebConfig.java
│       ├── resources
│       │   ├── application.properties
│       │   └── log4j.properties
│       └── webapp
│           ├── resources
│           │   ├── jquery.js
│           │   └── style.css
│           └── WEB-INF
│               └── views
│                   ├── layout.html
│                   ├── login.html
│                   └── menu.html
└── pom.xml

ApplicationConfig:
@Bean
public DataSource dataSource() {
    ...
}

@Bean
public SessionBean sessionBean() {
    return new SessionBean();
}

public static void main(String[] args) {
    SpringApplication.run(ApplicationConfig.class, args);
}

ThymeleafConfig:
@Bean
public TemplateResolver templateResolver(){
    ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
    templateResolver.setPrefix("/WEB-INF/views/");
    templateResolver.setSuffix(".html");
    templateResolver.setTemplateMode("HTML5");
    return templateResolver;
}

@Bean
public SpringTemplateEngine templateEngine(){
    SpringTemplateEngine templateEngine = new SpringTemplateEngine();
    templateEngine.setTemplateResolver(templateResolver());
    templateEngine.addDialect(new LayoutDialect());
    return templateEngine;
}

@Bean
public ViewResolver viewResolver(){
    ThymeleafViewResolver viewResolver = new ThymeleafViewResolver() ;
    viewResolver.setTemplateEngine(templateEngine());
    viewResolver.setOrder(1);
    return viewResolver;
}

WebConfig:
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/resources/**")
            .addResourceLocations("/resources/");
}

I managed to include the WEB-INF folder by adding it as resource in pom.xml, but the views are still not resolved.

A:

Have you tried removing the WEB-INF folder completely and sticking everything in resources as is done in this guide?

