springboot 2.0及以上版本 返回静态页面错误

springboot 2.0 返回静态页面错误


最近想写个支付宝接口 用springboot简单搭建 后端返回界面路径错误 特刺记录

pom.xml添加依赖

  <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-thymeleafartifactId>
  dependency>

application.properties

spring.mvc.view.prefix=/templates/
spring.mvc.view.suffix=.html
spring.mvc.static-path-pattern=/static/**

controller

@Controller
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping(value = "/index")
    public String index(){
        return "index";
    }
 }

项目结构
springboot 2.0及以上版本 返回静态页面错误_第1张图片

你可能感兴趣的:(springboot项目)