My previous notes described how to do this for Spring 5.

That old approach no longer works for Spring 6.

Instead you can use the following Maven dependencies:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<dependency>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf</artifactId>
    <version>3.1.2.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf-spring6</artifactId>
    <version>3.1.2.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>6.0.11</version>
</dependency>

Note the use of the Spring 6 spring-context dependency. This pulls in some additional Spring dependencies, including SpEL (Spring’s expression language), which is used by Thymeleaf’s Spring dialect.

Configuring your Thymeleaf template engine to use the Spring dialect has not changed. See my previous notes for details.