拦截器注入Service报空指针的坑
发表于|更新于
|浏览量:
今天写了个拦截器,注入一个Service,结果没注入进去,报空指针
后来发现原来在拦截器配置处需要用@Bean的形式注入
并且在上面addInterceptor里面调用该函数
1 | @Override |

相关推荐
2024-03-19
liteflow快速开始
人类永远会选择他们理解的,摒弃不理解的。这个世界唯一剩下的动物,就是他们已经驯服的那些,匍匐在他们的脚边,或者那些非常警觉,一察觉到他们靠近就逃离的动物,没有介于二者之间的。——《西部世界》 今天上手用了下liteflow,感觉非常不错 首先引入 12345<dependency> <groupId>com.yomahub</groupId> <artifactId>liteflow-spring-boot-starter</artifactId> <version>2.11.4.2</version></dependency> 编写A组件 1234567891011121314151617181920212223import com.yomahub.liteflow.annotation.LiteflowComponent;import com.yomahub.liteflow.core.NodeComponent;import com.yomahub.lit...
2023-02-25
mapstruct-plus
让礼一寸,得礼一尺——曹操 分享一个框架mapstruct-plus: 官网:https://mapstruct.plus/ 可以很方便使用mapstruct
2024-03-26
idea下载不下来maven三方库源码处理(二)
把每一个黎明看作是生命的开始,把每一个黄昏看作你生命的小结。——罗斯金 实际上我这里就是因为配置maven镜像不正确导致的: 原先我的配置: 123456<mirror> <id>nexus-tencentyun</id> <mirrorOf>central</mirrorOf> <name>Nexus tencentyun</name> <url>http://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url></mirror> 现在: 123456<mirror> <id>nexus-tencentyun</id> <mirrorOf>*</mirrorOf> <name>Nexus tencentyun</name> <url>htt...
2022-10-26
PersistJobDataAfterExecution注解
心地善良的人、富于幻想的人比冷酷残忍的人更容易聚合——约翰逊 quartz之前我们也聊过了,今天说下这个注解org.quartz.PersistJobDataAfterExecution 一般和DisallowConcurrentExecution搭配使用 PersistJobDataAfterExecution表示Job执行结束后更新JobDataMap DisallowConcurrentExecution表示不允许并发执行 12345678910111213141516171819202122232425262728293031@Slf4j@DisallowConcurrentExecution@PersistJobDataAfterExecutionpublic class SettlementJob implements Job { /** * <p> * Called by the <code>{@link Scheduler}</code> when a <code&g...
2022-07-27
sql注入工具类
日出之美便在于它脱胎于最深的黑暗。——辛夷坞 在mybatis-plus中内置了该工具类: 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950/* * Copyright (c) 2011-2022, baomidou (jobob@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, s...
2022-04-30
java泛型指定继承和实现
得到了再失去,总是比从来没有得到更伤人。——《追风筝的人》 我们使用泛型的时候,可以如下限定类型: 123public static class Obj<T extends Obj<T>> {} 那么我们Obj中的泛型就只能指定为继承了Obj的类 1Obj<ObjChild> obj = new Obj<>(); 例如: 12public static class ObjChild extends Obj<ObjChild> {} 我们如果想要限定,既继承了Obj,且实现了Serializable接口的类,就可以使用&符号这么写: 123public static class Obj<T extends Obj<T> & Serializable> {} 我们相应的子类,就需要这么写才符合泛型 12public static class ObjChild extends Obj<ObjChild> ...

阿超
我的名字叫阿超 年龄25岁 家在北京市 职业是软件开发 每天最晚也会在八点前回家 不抽烟 酒浅尝辄止 晚上十二点上床 保证睡足八个小时 睡前写一篇博客 再做二十分钟俯卧撑暖身 然后再睡觉 基本能熟睡到天亮 像婴儿一样不留下任何疲劳和压力 就这样迎来第二天的早晨 健康检查结果也显示我很正常 我想说明我是一个不论何时都追求内心平稳的人 不拘泥于胜负 不纠结于烦恼 不树立使我夜不能寐的敌人 这就是我在这社会的生活态度
Follow Me公告
This is my Blog