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 ...
随机推荐
- Struts2:request & response
整理自网上: 1. 获取Request和Response的方法 1.1. ServletActionContext的静态方法 HttpServletRequest request = ...
- Badboy参数化 - Add Variable(循环使用不同的关键字进行搜索)
参考: http://leafwf.blog.51cto.com/872759/1113716 http://www.51testing.com/html/00/130600-1367743.html ...
- B-Quadratic equation_2019牛客暑期多校训练营(第九场)
题意 解下列方程 \((x+y) \equiv b \ mod \ p\) \((x\ *\ y) \equiv c \ mod \ p\) 题解 \(y = b-x\) 带入二式 \(x * (b- ...
- HDU-5977 - Garden of Eden 点分治
HDU - 5977 题意: 给定一颗树,问树上有多少节点对,节点对间包括了所有K种苹果. 思路: 点分治,对于每个节点记录从根节点到这个节点包含的所有情况,类似状压,因为K<=10.然后处理每 ...
- 【欧拉降幂】Super_log
In Complexity theory, some functions are nearly O(1)O(1), but it is greater then O(1)O(1). For examp ...
- poj 2777 Count Color(线段树(有点意思))
题目链接 http://poj.org/problem?id=2777 题意:题意是有L个单位长的画板,T种颜色,O个操作.画板初始化为颜色1.操作C讲l到r单位之间的颜色变为c,操作P查询l到r单位 ...
- 工作中遇到的99%SQL优化,这里都能给你解决方案(二)
-- 示例表 CREATE TABLE `employees` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(24) NOT NULL ...
- SVN更新失败
一.svn更新失败 使用svn遇到的问题是,更新失败,代码被锁定. 解决办法: 在项目上右键,如图所示: 图一: 图二: 之后再更新,基本上都没有问题了.如果还有问题,看下面. 二.工具清理 ...
- 为什么spark中只有ALS
WRMF is like the classic rock of implicit matrix factorization. It may not be the trendiest, but it ...
- Vert.x 之 HelloWorld
Hello World 欢迎来到Vert.x的世界,相信您在接触Vert.x的同时,迫不及待想动手试一试,如您在学习计算机其它知识一样,总是从Hello World开始,下面我们将引导您制作一个最基本 ...