#Springboot第五天
##映射器
在项目目录下建立config目录,用mvcconfig来统一设置各个请求的映射和路由
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ZXRVFJDg-1618402954097)(file:///C:\Users\86130\AppData\Roaming\Tencent\Users\1765772391\QQ\WinTemp\RichOle\GTJ]5C]Y18Y@]AL$Q3`HYAG.png)]
1.为dashboard视图映射为main.html
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/main.html").setViewName("dashboard");
}
2.为所有从网页上发出的请求添加拦截器
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/**").excludePathPatterns("/index.html","/","/user/login",
"/css/**","/img/**","/js/**");
}