Spring Boot MVC

yml配置模板:

 thymeleaf:
    cache: false
    prefix: classpath:/templates/
    suffix: .html
    encoding: UTF-8
    mode: HTML
    servlet:
      content-type: text/html

自动配置扩展

@Configuration
//@EnableWebMvc 覆盖默认配置加此标签
public class CustomWebMvcConfigurer implements WebMvcConfigurer{

}

静态资源默认路径:static public resources

欢迎界面:resources/static/index.html

webjars jquery:
grade引入

    compile group: 'org.webjars', name: 'webjars-locator-core', version: '0.35'
    compile group: 'org.webjars', name: 'jquery', version: '3.3.1-1'

html引入:


view Controller:

@Controller
@RequestMapping("/user/")
public class ViewController {
    @RequestMapping("/userList")
    public String index(){
        return "list";
    }
}

你可能感兴趣的:(Spring Boot MVC)