springboot加载thymeleaf模块找不到html的问题解决
解决方案:
一、文件目录结构要正确,下图为正确示例:
注意点:
1.主类入口BlogApplication要和com.wxb下的包在同级目录springboot后会自动扫描其同级目录及其子包;
2.html文件要放在resources下的templates包里。
二、在配置文件里要加上
resources:
static-locations: classpath:/templates/
三、在类中将@RestController注解,改成@Controller就好了,否则返回的是字符串