springboot项目
在用idea写纯springboot项目中,实现后台登录过程,要用templates文件夹下的html页面,但一直显示不出来。
解决办法:
在pom.xml中添加
<dependency>
<groupId>org.springframework.boot</
groupId>
<artifactId>spring-boot-starter-thymeleaf</
artifactId>
</dependency>
在application中加上
server:
port: 8082//端口号
spring:
resources:
static-locations=classpath:/templates/
以上就解决了,可能还需要clean,install一下。
同理,如果还想访问static下的css,js等,也要在application中加入:
spring.resources.static-locations=classpath:/templates/,classpath:/static/

浙公网安备 33010602011771号