springboot 2.0 返回静态页面错误
最近想写个支付宝接口 用springboot简单搭建 后端返回界面路径错误 特刺记录
pom.xml添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</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";
}
}
项目结构