[Solved] org.thymeleaf.exceptions.TemplateInputException: Error resolving template

report errors:

org.thymeleaf.exceptions.TemplateInputException: Error resolving template [queryUserList], template might not exist or might not be accessible by any of the configured Template Resolvers
	at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE]
	at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) ~[thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) ~[thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE]
    1. when the controller layer finished processing the request and returned, it did not use @Restcontroller or @ResponseBody but returned a non JSON format
    1. in this case, the returned data thymeleaf template cannot be parsed and an error is directly reported. I officially reported an error for this reason

Solution: you can change @Controller to @Restcontroller, but you should pay attention to whether other methods return HTML pages, which will result in string instead of page; The best way is to add a @ResponseBody to the requested method.

      1. when the corresponding method of your controller layer returns the HTML path and name, add an additional /

For example, return “/ index”. If this/causes an error, the solution is to remove the/in front of the return, such as return “/ index”.

        1. in the process of using springboot, if thymeleaf is used as the template file, the HTML format must be strict HTML5 format and there must be an end tag, otherwise an error will be reported</ ol>

The solution is as follows:
add the following configuration in application.yml

spring.thymeleaf.content-type: text/html 
spring.thymeleaf.cache: false 
spring.thymeleaf.mode: LEGACYHTML5

Add the following dependencies in pom.xml


The path of the

          1. resource file has been modified. If your other requests return normally, you can ignore this one

Solution: add in the of pom.xml file


Read More: