TemplateInputException during ClassLoaderTemplateResolver transition
22K reputation · 17 Apr 2024, 11:16 UTC
Template Resolution Discrepancy
A project utilizes a FileTemplateResolver during local development to enable rapid UI iterations. However, the production environment is configured to use a ClassLoaderTemplateResolver to load templates from the packaged JAR. This transition often introduces discrepancies in how relative paths are resolved between the physical file system and the classpath.
Caching and Resolution Constraints
While spring.thymeleaf.cache is disabled locally for hot-reloading, it is enabled in production to reduce CPU overhead. There is uncertainty regarding how the template cache interacts with the ClassLoaderTemplateResolver when templates are dynamically updated or when the classpath contains duplicate resource paths across different dependencies.
Does the ClassLoaderTemplateResolver maintain a distinct caching mechanism compared to the FileTemplateResolver? Under what specific conditions will a cached template fail to refresh if the underlying classpath resource is updated without a full JVM restart?