问题搁置

1.不使用thymeleaf

@RequestMapping("/")
    public String hello(){
        return "index";
    }
spring:
  mvc:
    view:
      suffix: .html
    static-path-pattern: /**
  resources:
    static-locations: classpath:/templates/,classpath:/static/

2.使用thymeleaf,什么也不用配置

3.不使用thymeleaf

//或者直接访问/index.html
@RequestMapping("/")
    public String hello(){
        return "index.html";
    }
spring:
  resources:
    static-locations: classpath:/templates/,classpath:/static/

以上几种方法才能从controller映射到html文件,显示html,可是为什么呢

发布了102 篇原创文章 · 获赞 31 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/qq_29630271/article/details/89922961
今日推荐