
奇技淫巧
每天只学一点点
If you are good at something, never do it for free。
展开
-
监听类使用@Autowired无法注入Bean解决办法
在进行项目对接中,在使用过程中,在监听类中无法使用@Autowired注解无法注入Mapper和Service。执行过程中Mapper和Service为null,无法注入。直接搞代码:/** * 方法一 * @author huangqh * @create 2020/12/25 16:34 * @Notes 注释 */// Component将类交给Spring管理@Componentpublic class Util { //注入需要使用的Mapper或Service原创 2020-12-25 18:15:49 · 665 阅读 · 1 评论 -
Spring Security 认证成功 AuthenticationSuccessEvent多次调用问题
在使用Spring Security Oauth2的使用,需要在认证成功执行执行一些日志记录和更新的操作,所以就使用了AuthenticationSuccessEvent来进行认证成功的回调。但是遇到了其他问题也都解决了,就是在每次认证求中多次调用的问题,因为对Spring事件监听基本上没有使用过,为了防止多次执行event 就想了一些歪点子。@Componentpublic class ApplicationListenerAuthencationSuccess implements Applicat原创 2020-12-04 17:33:11 · 4748 阅读 · 1 评论