一、404问题
1.启动类要在包含注解的那些类,就是放在最高层就可以了
2.路径问题
3.导入依赖后记得记得更新啊
4.接收参数形式问题
二、静态文件拦截问题
文档结构
@Configuration
public class MyConfig implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("login");
registry.addViewController("/login").setViewName("login");
}
@Override
public void addInterceptors(InterceptorRegistry registry) {//并不是 /static/**
registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/**").excludePathPatterns("/login","/index","/dologin","/","/asserts/**");
}
@Bean
public LocaleResolver localeResolver() {
return new MyLocaleResolver();
}
}