My problem is that I fail to show a Thymeleaf template. I suspect a config error, but I can't seem to find it. Thanks in advance :)
pom.xml:
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.1.RELEASE</version> </parent> ... <properties> ... <thymeleaf.version>3.0.9.RELEASE</thymeleaf.version> <thymeleaf-layout-dialect.version>2.0.3</thymeleaf-layout-dialect.version> </properties> ... <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>nz.net.ultraq.thymeleaf</groupId> <artifactId>thymeleaf-layout-dialect</artifactId> </dependency> Template is in: src/main/resources/templates/home.html
Spring config:
server.servlet.context-path=/mityo server.port=8080 ... spring.thymeleaf.enabled=true spring.thymeleaf.cache=false spring.thymeleaf.check-template=true spring.thymeleaf.check-template-location=true spring.thymeleaf.mode=html5 spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.suffix=.html spring.thymeleaf.prefix=/resources/templates/ Controller:
@Controller @RequestMapping("buy") public class HomeController { public String buy(Model model) { return "home"; } } I'm trying to access: localhost:8080/mityo/buy and getting 404.
Another thing, can anyone explain (or give a link to docs) which servlet is used to "return" the templates html? Is it the Spring dispatcher servlet?
Ok so I had forgotten the @GetMapping, thanks @benjamin c. Adding it however produces:
org.thymeleaf.exceptions.TemplateInputException: Error resolving template "home", template might not exist or might not be accessible by any of the configured Template Resolvers