4.7 引入资源
1.设置默认首页-静态资源文件夹下的templates
方法一:
//访问“/,/index.html”的时候会去静态资源文件templetas下查找以index命名的html文件
@RequestMapping({"/", "/index.html"})
public String index(){
return "index";
}
方法二:
@Override
public void addViewControllers(ViewControllerRegistry registry) {
//super.addViewControllers(registry);
//浏览器发送xxx(前一个参数) 请求来到xxx页面(后一个参数)
registry.addViewController("/ella").setViewName("success");
registry.addViewController("/").setViewName("login");
registry.addViewController("/index.html").setViewName("login");
}
方法三:
//所有的WebMvcConfigure