TemplateInputException with Thymeleaf 3.x on Spring Boot 1.5
0 reputation · 23 Oct 2023, 23:22 UTC
Problem Context
When a Spring Boot 1.5 application declares a direct dependency on Thymeleaf 3.x, startup fails with a TemplateInputException that wraps a NoSuchMethodError for org.thymeleaf.spring5.SpringTemplateEngine.process(...). The error indicates that the Spring Boot 1.5 starter expects the older org.thymeleaf.spring4 integration classes.
Constraints and Uncertainty
• Spring Boot 1.5 is locked by legacy project requirements.
• Thymeleaf 3.x is desired for its new features and bug fixes.
• The Spring Boot 1.5 starter pulls in Thymeleaf 2.x transitively, leading to a classpath conflict.
Unresolved Decision
Developers must decide whether to upgrade Spring Boot to a version that bundles Thymeleaf 3.x, or to downgrade the Thymeleaf dependency to 2.x to maintain compatibility with Spring Boot 1.5.
Questions
- Is Thymeleaf 3.x officially supported by Spring Boot 1.5, or is a minimum Spring Boot 2.x required for the spring5 integration?
- What is the recommended approach for resolving the
NoSuchMethodErrorwithout breaking auto‑configuration? - Can the transitive Thymeleaf dependency be excluded from the Spring Boot starter and replaced with a compatible version, and what are the risks?