这里简单说一下spring-boot要运行的页面放在哪个文件夹以及thymleaf模板运行在哪个文件夹的配置问题。
spring-boot运行的页面都是放在templates文件夹里面,在application.properties配置如下代码
server.port=8080
server.servlet.context-path=/
#thymleaf模板引擎
#th模板文件夹
spring.thymeleaf.prefix=classpath:templates/
#运行路径文件夹
spring.resources.static-locations=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.resources.static-locations=classpath:/templates/ 这个路径就是我们页面放在了哪个文件夹要运行的路径。想运行哪个文件夹就改掉classpath:/templates(这里指要运行文件夹)/
而我们的thymleaf模板的话,基本也是页面在哪个文件夹里面,路径就写哪个文件夹。
spring.thymeleaf.prefix=classpath:templates/
经过了多次测试。放心使用。