项目背景

​ 公司内部某架构系统,在shrio realm中注入使用了RedisUtils

    @AutowiredRedisUtils redisUtils;

问题描述

本身项目的redis是使用aopyml控制开关的,但是突然发现aop失效了,无法开关redis在控制台没有报错出现但是有如下输出:

Bean 'shiroConfig' of type [com.jack.modules.njp.security.config.ShiroConfig$$EnhancerBySpringCGLIB$$7aac9763] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.267  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.redis-org.springframework.boot.autoconfigure.data.redis.RedisProperties' of type [org.springframework.boot.autoconfigure.data.redis.RedisProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.270  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration' of type [org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.348  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'lettuceClientResources' of type [io.lettuce.core.resource.DefaultClientResources] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.401  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'redisConnectionFactory' of type [org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.401  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'redisConfig' of type [com.jack.common.redis.RedisConfig$$EnhancerBySpringCGLIB$$4dab53ba] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.509  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'redisTemplate' of type [org.springframework.data.redis.core.RedisTemplate] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.510  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'redisUtils' of type [com.jack.common.redis.RedisUtils] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.510  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'oauth2Realm' of type [com.jack.modules.njp.security.oauth2.Oauth2Realm] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.516  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'sessionManager' of type [org.apache.shiro.web.session.mgt.DefaultWebSessionManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.643  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'securityManager' of type [org.apache.shiro.web.mgt.DefaultWebSecurityManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.688  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'authorizationAttributeSourceAdvisor' of type [org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.871  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.886  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationChannelResolver' of type [org.springframework.integration.support.channel.BeanFactoryChannelResolver] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:31.888  INFO 7908 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-02 15:33:32.143  INFO 7908 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  :

就突然发现有关于redisUtils的问题

redisUtils' of type [com.jack.common.redis.RedisUtils] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

翻译一下意思是 :该bean无法被所有的BeanPostProcessors处理(例如:无法创建自动代理)

无法aop本身就是基于代理实现的,现在无法获取代理类aop自然无法实现了。

问题解决

@Component
public class Oauth2Realm extends AuthorizingRealm {@Lazy@Autowiredprivate ShiroService shiroService;@Lazy@AutowiredRedisUtils redisUtils;
}

将realm 注入的autowired加上懒加载即可

原因分析

参考https://www.cnblogs.com/micrari/p/7354650.html bean的创建过程

org.springframework.beans.factory.support.AbstractBeanFactory#doGetBean打断点

很久才能进来

往前找依赖

redisUtils->oauth2Realm

redisUtils->oauth2Realm->securityManager

redisUtils->oauth2Realm->securityManager->shiroFilter

redisUtils->oauth2Realm->securityManager->shiroFilter->shiroConfig

在这里已经看到了shiroFilterpostprocessor

@Bean("shiroFilter")
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();shiroFilter.setSecurityManager(securityManager);
}
public class ShiroFilterFactoryBean implements FactoryBean, BeanPostProcessor {

因为作为我们的redisUtils作为了postprocessor的依赖则无法创建代理

切面(@Aspect)和事务(@Transactional)莫名失效:`is not eligible for getting processed by all BeanPostProcesso相关推荐

  1. 面试一口气说出Spring的声明式事务@Transactional注解的6种失效场景

    一.Spring事务管理的两种方式 事务管理在系统开发中是不可缺少的一部分,Spring提供了很好事务管理机制,主要分为编程式事务和声明式事务两种. 编程式事务:是指在代码中手动的管理事务的提交.回滚 ...

  2. Spring 之注解事务 @Transactional

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 先让我们看代码吧! 以下代码为在"Spring3事务管理--基于tx/aop命名空间的配置 ...

  3. 一口气说出 6种 @Transactional 注解失效场景

    引言 昨天公众号粉丝咨询了一个问题,说自己之前面试被问@Transactional注解哪些场景下会失效,一时语塞致使面试失败.所以今天简单的和大家分享一下@Transactional相关的知识. @T ...

  4. @getmapping注解的作用_@Transactional注解失效了?你遇到的是这6种场景吧!

    引言 昨天公众号粉丝咨询了一个问题,说自己之前面试被问@Transactional注解哪些场景下会失效,一时语塞致使面试失败.所以今天简单的和大家分享一下@Transactional相关的知识. @T ...

  5. @Transactional又双叒叕失效了?

    引言 又到了喜闻乐见的 @Transactional 注解失效环节 正文 md,@Transactional注解又又又又"失效"了. 这次是在单元测试中失效了:单元测试的时候,为啥 ...

  6. Spring 事务管理及失效总结

    Spring 事务管理及失效总结 所谓事务管理,其实就是"按照给定的事务规则来执行提交或者回滚操作". Spring 并不直接管理事务,而是提供了多种事务管理器,他们将事务管理的职 ...

  7. 【spring】切入点(Pointcut)、方面/切面(Aspect、Advisor)详解

    文章目录 1. Pointcut概念的引入及简介 1.1 Pointcut接口 1.1.1 ClassFilter接口 1.1.2 MethodMatcher接口 1.1.3 TruePointcut ...

  8. 事务 Transactional注解

    前言 事务:4种事务特性,5种隔离级别,7种传播行为 一.什么是事务? 事务逻辑上的一组操作,组成这组操作的各个逻辑单元,要么一起成功,要么一起失败. 二.事务的特性(4种) 原子性 (atomici ...

  9. 仰天长啸 Spring 之注解事务 @Transactional

    spring 事务注解 默认遇到throw new RuntimeException("...");会回滚 需要捕获的throw new Exception("...&q ...

最新文章

  1. 队列的基本原理及实现
  2. Ransomware Cerber Analysis
  3. apk静态注射[转]-未实践
  4. sql注入攻击和PreparedStatement有效防止sql注入攻击
  5. C++ primer第六章6.7函数指针
  6. 【debug】写应用程序时遇到的桌面图标、运行图标、背景图片问题
  7. jssdk 获取微信收货地址_微信收货地址共享开发接口讲解
  8. rs(0)与rs(字段名)的区别
  9. String特殊值的判断方式
  10. 【优化分类】基于matlab改进的人工蜂群算法优化SVM分类【含Matlab源码 1833期】
  11. 附合导线计算软件_再也不盲目跑杆了,一次性搞懂水准测量+导线测量!
  12. CI框架(4)-页面跳转
  13. 集成运放(一)--同相、反相和差动差分放大电路
  14. python源码解读之 string.py
  15. 【ModelMapper简单使用】
  16. MyBatis中的大于号小于号怎么表示
  17. 微信小程序自定义map组件标记点markers(兼容苹果和安卓)
  18. unity应用实例——从头撸一个全新的FPS游戏(1)
  19. 音乐翻唱软件测试初学者,音乐APP听歌识曲大评测,QQ音乐独家“翻唱识别”领跑...
  20. beyond compare 用法

热门文章

  1. 登录失败:用户帐户限制。可能的原因包括不允许空密码,登录时间限制,或强制的策略限制。 ...
  2. 判断手机设备是否支持5G无线频段
  3. 新浪微博搜索 s.weibo.com [已失效]
  4. 计算机表格大小怎么调整,EXCEL如何根据内容自动调整表格尺寸?
  5. 人工智能 漆桂林_认识一下计算机的新成员——人工智能
  6. 使用 prometheus 监控 MySQL
  7. 故障诊断——奇异值分解法hankel矩阵
  8. 前后台处理得到 前台图片 draw.io/ mxgraph
  9. 解决Failed to connect to github.com port 443 after 21113 ms: Timed out
  10. 用计算机时的注意事项,计算机使用注意事项