首页>代码>springboot+jpa+bootstrap+mysql用户登录+增删改查 运行环境为IDEA>/springboot-jba/src/main/java/ng/bq/springbootjba/config/MyMvcConfig.java
package ng.bq.springbootjba.config; import ng.bq.springbootjba.component.MyLocalResolver; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration public class MyMvcConfig extends WebMvcConfigurerAdapter { public void addViewControllers(ViewControllerRegistry registry){ // super.addViewControllers(registry); //浏览器发送 /atguigu请求来到 registry.addViewController("/atguigu").setViewName("success"); } //所有的WebMvcConfiguration组件都会一起起作用 @Bean//将容器注册在容器 public WebMvcConfigurerAdapter webMvcConfigurerAdapter(){ WebMvcConfigurerAdapter adapter = new WebMvcConfigurerAdapter() { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("login"); registry.addViewController("/index.html").setViewName("login"); // registry.addViewController("/main.html").setViewName("dashboard"); } // //注册拦截器 @Override public void addInterceptors(InterceptorRegistry registry) { //super.addInterceptors(registry); // 静态资源 // SpringBoot已经做好静态资源的映射 // registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/**") // .excludePathPatterns("/index.html","/","/user/login"); } }; return adapter; } @Bean public LocaleResolver localeResolver(){ return new MyLocalResolver(); } }

可乐要加冰1 LV8
2024年11月29日
15342201772 LV9
2024年6月26日
计科一班 LV7
2024年6月19日
15719908287 LV10
2024年5月28日
skipple3 LV39
2023年10月25日
飞呀飞呀飞不放 LV7
2023年8月9日
hbsoft2008 LV16
2023年3月21日
lyws1986 LV17
2023年3月13日
微信网友_6368711690080256 LV3
2023年2月28日
zhaoming200677 LV13
2022年12月3日

可乐要加冰1 LV8
2024年11月29日
15342201772 LV9
2024年6月26日
TY0165 LV20
2024年6月25日
17380184110
2024年6月19日
暂无贡献等级
计科一班 LV7
2024年6月19日
15719908287 LV10
2024年5月28日
2726018975 LV1
2024年5月25日
shuangfu LV25
2024年5月7日
saviorasd LV1
2024年4月19日
WBelong LV8
2024年4月2日