Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 如何在spring boot中为thymeleaf设置前缀路径_Spring Boot - Fatal编程技术网

Spring boot 如何在spring boot中为thymeleaf设置前缀路径

Spring boot 如何在spring boot中为thymeleaf设置前缀路径,spring-boot,Spring Boot,如何设置前缀路径(设置新目录)以呈现HTML页面 我有一个spring启动应用程序。我使用的是2.1.7版 我被设置为查看页面的新路径 在Application.properties中添加以下行 spring.thymeleaf.check-template-location=true spring.thymeleaf.prefix=classpath:/templates/views/ #this is the main spring.thymeleaf.suffix=.html sp

如何设置前缀路径(设置新目录)以呈现HTML页面

我有一个spring启动应用程序。我使用的是2.1.7版

  • 我被设置为查看页面的新路径
在Application.properties中添加以下行

spring.thymeleaf.check-template-location=true
spring.thymeleaf.prefix=classpath:/templates/views/    #this is the main
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.servlet.content-type=text/html
spring.thymeleaf.cache=false
spring.main.allow-bean-definition-overriding=true

您可以使用基本设置,也可以通过覆盖application.properties中的属性来提供自己的自定义页面

一个前缀,用于在生成URL时查看名称

spring.thymeleaf.prefix=classpath:/config/templates/

在Application.properties“spring.thymeleaf.prefix=classpath:/templates/views/”中添加以下行