0

Exclude Embedded Tomcat in Spring Boot when using Thymeleaf

This post demonstrates how to exclude the embedded tomcat dependencies in Spring Boot when using only Thymeleaf. Usually, we wouldn’t think that these dependencies are included when we haven’t selected the “Web” module in the Spring Initialzr.

Spring Initializr with no Web

Using http://start.spring.io, this is how we would create a maven project with only Thymeleaf.

This would generate this pom.xml

Exclude Embedded Tomcat jar files

You can exclude these files using Eclipse but it will just update your pom.xml with <exclusions> tags in

Using Eclipse

In your project tree, navigate to “Maven Dependencies” and look for “tomcat-embed-*.jar” files. Then, select them and right click to select Maven > Exclude Maven Artifact…

[wp_ad_camp_31]

Then this window opens up.

Just click “Ok”.

This will ultimately update your pom.xml to:

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert