How to locate Thymeleaf template from spring boot

前端 未结 5 1079
梦谈多话
梦谈多话 2021-01-02 23:56

I am trying to follow this tutorial at http://www.thymeleaf.org/doc/articles/springmvcaccessdata.html to learn how to send responses to Thymeleaf template. But I get this er

5条回答
  •  孤独总比滥情好
    2021-01-03 00:36

    Spring Boot includes auto-configuration support for the thymeleaf templating engines, your templates will be picked up automatically from src/main/resources/templates.

    if you are customize you template location then use below thymeleaf property configuration available in Spring Boot.

    • spring.thymeleaf.check-template=true # Check that the template exists before rendering it.

    • spring.thymeleaf.check-template-location=true # Check that the templates location exists.

    • spring.thymeleaf.enabled=true # Enable MVC Thymeleaf view resolution.

    • spring.thymeleaf.prefix=classpath:/templates/ # Prefix that gets prepended to view names when building a URL.

    • spring.thymeleaf.suffix=.html # Suffix that gets appended to view names when building a URL.

提交回复
热议问题