pom中引入thymeleaf依赖
org.springframework.boot
spring-boot-starter-thymeleaf
配置application.properties
是让controller层到templates文件夹寻找xx.html(src/main/resources/templates)
spring.thymeleaf.prefix=classpath:/templates/
在templates下建立index.html文件
TitleTest
新建一个controller
package com.example.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Created by kemp on 2018/8/15.
*/
@Controller
@RequestMapping("/sys")
public class MyController {
@RequestMapping("/test")
public String test(){
return "index";
}
}
标签:templates,RequestMapping,springframework,controller,html,跳转,org,springboot
来源: https://blog.csdn.net/WSF34588940/article/details/116890881