过时应用:

@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替代的更多相关文章

  1. springboot技术

      一 我们为什么要用SpringBoot? 1. SpringBoot核心功能 SpringBoot的核心最足要的功能是自动配置,简单说下springBoot,springboot可以替代额xml配 ...

  2. springboot 配置

    springboot 配置文件中属性变量引用方式@@解析 这种属性应用方式是field_name=@field_value@. 两个@符号是springboot为替代${}属性占位符产生,原因是${} ...

  3. springboot 配置文件中属性变量引用方式@@解析

    这种属性应用方式是field_name=@field_value@. 两个@符号是springboot为替代${}属性占位符产生,原因是${}会被maven处理,所以应该是起不到引用变量的作用. @@ ...

  4. SpringBoot Web开发(3) WebMvcConfigurerAdapter过期替代方案

    springboot2.0中 WebMvcConfigurerAdapter过期替代方案 最近在学习尚硅谷的<springboot核心技术篇>,项目中用到SpringMVC的自动配置和扩展 ...

  5. SpringBoot 很重要的一个类WebMvcConfigurerAdapter 的使用

    自定义资源映射addResourceHandlers 比如,我们想自定义静态资源映射目录的话,只需重写addResourceHandlers方法即可. @Configuration public cl ...

  6. SpringBoot(十六):SpringBoot2.1.1集成fastjson,并使用fastjson替代默认的MappingJackson

    springboot2.1.1默认采用的json converter是MappingJackson,通过调试springboot项目中代码可以确定这点.在springboot项目中定义WebMvcCo ...

  7. SpringBoot自定义servlet、注册自定义的servlet、过滤器、监听器、拦截器、切面、webmvcconfigureradapter过时问题

    [转]https://www.cnblogs.com/NeverCtrl-C/p/8191920.html 1 servlet简介 servlet是一种用于开发动态web资源的技术 参考博客:serv ...

  8. Springboot 轻量替代框架 Solon 1.3.10 发布

    Solon 是一个微型的Java开发框架.项目从2018年启动以来,参考过大量前人作品:历时两年,4000多次的commit:内核保持0.1m的身材,超高的跑分,良好的使用体验.支持:RPC.REST ...

  9. SpringBoot——》WebMvcConfigurerAdapter详解

    一.WebMvcConfigurerAdapter是什么二.WebMvcConfigurerAdapter常用的方法1.addInterceptors:拦截器2.addCorsMappings:跨域3 ...

随机推荐

  1. Leetcode之回溯法专题-46. 全排列(Permutations)

    Leetcode之回溯法专题-46. 全排列(Permutations) 给定一个没有重复数字的序列,返回其所有可能的全排列. 示例: 输入: [1,2,3] 输出: [ [1,2,3], [1,3, ...

  2. [Python] 通过采集23万条数据,对《哪吒》影评分析

    一.说明 数据来源:猫眼: 运行环境:Win10/Python3.7 和 Win7/Python3.5: 分析工具:jieba.WorldCloud.pyecharts和matplotlib: 程序基 ...

  3. python3 统计类的实例个数

    python3 统计类的实例个数 有时候我们可能想统计下类所创建的实例个数,代码如下: class Dog: # 定义一个狗类 count = 0 # 用于统计类所创建的实例个数 def __init ...

  4. Unity的UGUI在SetParent后修改UI的localposition问题

    正常情况下,UGUI设置UI的localposition可以直接赋值 UIxxx.rectTransform.localPosition = ] / 2f, , ); 运行后在Unity的Inspec ...

  5. HTML连载34-背景关联和缩写以及插图图片和背景图片的区别

    一.背景属性缩写的格式 1.backgound:背景颜色  背景图片  平铺方式  关联方式  定位方式 2.注意点: 这里的所有值都可以省略,但是至少需要一个 3.什么是背景关联方式 默认情况下,背 ...

  6. 线程、进程的区别,Java的几个线程状态

    线程.进程的区别        进程的定义:进程就是程序在一个数据集合上的一次执行过程.他与程序的区别在于程序是静态的代码,而进程是动态的执行过程. 进程的特性:1.结构性,进程由程序块.数据块.进程 ...

  7. 证书pfx转jks

    keytool -importkeystore -srckeystore  2756649_order.hanels-home.com.pfx -srcstoretype pkcs12 -destke ...

  8. 使用element-ui中table expand展开行控制显示隐藏

    问题讲解:在使用vue版本的ElementUI中的table功能的时候还是遇到了一些问题,可以说饿了么团队在这个UI框架的文档撰写已经非常不错了,不过还是有一些方法乍一看让人摸不着头脑,有些table ...

  9. net start mysql提示:服务名无效

    1.win+R打开运行窗口,输入services.msc 2.在其中查看mysql的服务名,我的是MySQL55 3.以管理员身份打开cmd,输入net start MySQL55 出现下图,代表my ...

  10. hud 3555 Bomb 数位dp

    Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Subm ...