springboot WebMvcConfigurerAdapter替代
过时应用:
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").excludePathPatterns("/user/login");
super.addInterceptors(registry);
}
}
新的替代:
@Configuration
public class WebMvcConfg implements WebMvcConfigurer {
//一系列实现方法
}
@Configuration
public class WebMvcConfg extends WebMvcConfigurationSupport {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").excludePathPatterns("/user/login");
super.addInterceptors(registry);
}
}
推荐使用后面那种方式
springboot WebMvcConfigurerAdapter替代的更多相关文章
- springboot技术
一 我们为什么要用SpringBoot? 1. SpringBoot核心功能 SpringBoot的核心最足要的功能是自动配置,简单说下springBoot,springboot可以替代额xml配 ...
- springboot 配置
springboot 配置文件中属性变量引用方式@@解析 这种属性应用方式是field_name=@field_value@. 两个@符号是springboot为替代${}属性占位符产生,原因是${} ...
- springboot 配置文件中属性变量引用方式@@解析
这种属性应用方式是field_name=@field_value@. 两个@符号是springboot为替代${}属性占位符产生,原因是${}会被maven处理,所以应该是起不到引用变量的作用. @@ ...
- SpringBoot Web开发(3) WebMvcConfigurerAdapter过期替代方案
springboot2.0中 WebMvcConfigurerAdapter过期替代方案 最近在学习尚硅谷的<springboot核心技术篇>,项目中用到SpringMVC的自动配置和扩展 ...
- SpringBoot 很重要的一个类WebMvcConfigurerAdapter 的使用
自定义资源映射addResourceHandlers 比如,我们想自定义静态资源映射目录的话,只需重写addResourceHandlers方法即可. @Configuration public cl ...
- SpringBoot(十六):SpringBoot2.1.1集成fastjson,并使用fastjson替代默认的MappingJackson
springboot2.1.1默认采用的json converter是MappingJackson,通过调试springboot项目中代码可以确定这点.在springboot项目中定义WebMvcCo ...
- SpringBoot自定义servlet、注册自定义的servlet、过滤器、监听器、拦截器、切面、webmvcconfigureradapter过时问题
[转]https://www.cnblogs.com/NeverCtrl-C/p/8191920.html 1 servlet简介 servlet是一种用于开发动态web资源的技术 参考博客:serv ...
- Springboot 轻量替代框架 Solon 1.3.10 发布
Solon 是一个微型的Java开发框架.项目从2018年启动以来,参考过大量前人作品:历时两年,4000多次的commit:内核保持0.1m的身材,超高的跑分,良好的使用体验.支持:RPC.REST ...
- SpringBoot——》WebMvcConfigurerAdapter详解
一.WebMvcConfigurerAdapter是什么二.WebMvcConfigurerAdapter常用的方法1.addInterceptors:拦截器2.addCorsMappings:跨域3 ...
随机推荐
- 牛客小白赛4 A 三角形 数学
链接:https://www.nowcoder.com/acm/contest/134/A来源:牛客网 题目描述 铁子从森林里收集了n根木棍,她开始将它们按顺序的排成一排,从左到右依次为1到n,她回想 ...
- codeforces 733D Kostya the Sculptor(贪心)
Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. K ...
- JOBDU 1199 找位置
题目1199:找位置 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2645 解决:1286 题目描述: 对给定的一个字符串,找出有重复的字符,并给出其位置,如:abcaaAB12ab12 ...
- Dungeon Master POJ - 2251 [kuangbin带你飞]专题一 简单搜索
You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of un ...
- 深入浅出TypeScript(4)- 使用接口和类型别名
在TypeScript中,为了可以约束对象定义,提供了两个新的特性,接口和类型别名. TypeScript中的接口 在强类型语言中,都有接口的概念,那么TypeScript中的接口是如何使用的呢? 接 ...
- 利用GPU训练网络时遇到的一些问题
1. OSError: [Error 12] Cannot allocate memory 解决办法: 出现这个错误时我是绝望的...因为我看了别人的解决办法,要加内存条才能解决...但是我不甘心,想 ...
- (六十二)c#Winform自定义控件-警灯(工业)
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kwwwvagaa/NetWinformControl 码云:ht ...
- 【LeetCode】56-合并区间
题目描述 给出一个区间的集合,请合并所有重叠的区间. 示例 1: 输入: [[1,3],[2,6],[8,10],[15,18]] 输出: [[1,6],[8,10],[15,18]] 解释: 区间 ...
- Python3实战Spark大数据分析及调度 (网盘分享)
Python3实战Spark大数据分析及调度 搜索QQ号直接加群获取其它学习资料:715301384 部分课程截图: 链接:https://pan.baidu.com/s/12VDmdhN4hr7yp ...
- Django之使用内置函数和celery发邮件
邮箱配置 开启stmp服务 以163邮箱为例,点击设置里面的stmp 开启客户端授权密码 如上所示,因为我已经开启了,所以出现的是以上页面. 这样,邮箱的准备就已经完成了. 使用Django内置函数发 ...