Hope this guide helps people to start building microservices with micronaut and template engines such as thymeleaf.
- Install Micronaut (see instructions on Micronaut Website)
- Create project with Micronaut CLI
(important: reload .bash_profile after install
$ source ~/.bash_profile
) - Create Micronaut project with
$ mn create-app micronaut-first-thymeleaf-app --build maven
(with Maven) (thencd
into project directory) - Create Micronaut Controller with
$ mn create-controller ApplicationController
- Write Micronaut app
- build and execute with
$ ./mvnw compile exec:exec
- Open browser and go to http://localhost:8080/main/ or http://localhost:8080/main/simpleTest
Most important step: Do not use micronaut-views
in pom.xml as mentioned in guide for server side view rendering,
use micronaut-views-thymeleaf
instead. Otherwise build will fail.
pom.xml:
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-views-thymeleaf</artifactId>
</dependency>
Useful Links: