启用了AOP 后,报这样的类似错误:

Error creating bean with name 'bpmpSysUserService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected com.bkc.bpmp.core.dao.BaseDao com.bkc.bpmp.core.service.BaseService.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bpmpSysUserMapper': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.sun.proxy.$Proxy24]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy24

(注:个人猜测,可能不正确)

1、其他的配置都如同网上相关的AOP 一般,这里不详写了,框架采用 SpringMVC+Spring+Mybatis

2、我这里的实际情况是 没有写 接口,写了一个BaseDao,BaseService 之类的,然后直接采用继承父类来实现,然后就报 上述的错误

  解决方法:这个配置写成这样 <aop:aspectj-autoproxy proxy-target-class="false"/> ,由于没有使用接口,AOP 代理采用 CGLIB, 需要在子类中都添加 默认的构造方法(理由不知)

3、我之前使用AOP 也出现过 注入失败的情况,采用一个接口、一个接口实现类,此时AOP 自动使用的代理是JDK

  解决方法:接口和接口实现类 命名需要区分,且 在注入的时候采用 接口 来创建对象

  

AOP 注入失败的问题的更多相关文章

  1. SpringAOP导致@Autowired依赖注入失败

    之前用springAOP做了个操作日志记录,这次在往其他类上使用的时候,service一直注入失败,找了网上好多内容,发现大家都有类似的情况出现,但是又和自己的情况不太符合.后来总结自己的情况发现:方 ...

  2. Spring Autowired 注入失败总是Null

    报错:NullPointerException 分析:错误原因是注入失败? <context:annotation-config/> <context:component-scan ...

  3. 【Intellij idea】spring中@Autowired注入失败

    @Autowired注入失败失败的解决办法? 现有的解决的方案是: 打开file-settings或者ctrl+alt+s -> Editor 然后在Inspections 点击搜索栏 输入Sp ...

  4. spring boot开发 @autowired注入失败

    @autowired注入失败 会出现如下错误提示: 2018-05-28 08:39:41.857 INFO 8080 --- [ restartedMain] org.hibernate.Versi ...

  5. 【Spring】Service 注入失败,空指针

    service层的类都有用@Service标识,但报空指针,注入失败,很可能是因为spring的application配置和springmvc的配置文件配置错误,导致容器冲突了. spring和spr ...

  6. Injection of autowired dependencies failed; autowire 自动注入失败,测试类已初始化过了Spring容器。

    1 严重: StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException: Error creat ...

  7. ssm中mapper注入失败的传奇经历

    最近因为要测试一个功能,需要用最短的时间来启动服务,开启测试程序,但平常所用的框架中已经集成了各种三方的东西,想着那就再重新搭建一个最简单的ssm框架吧. 搭建可参考:简单ssm最新搭建 搭建过程并不 ...

  8. Error creating bean with name 'unMblTotController': 注入失败

    今天新来的小伙子,进公司做项目,然后自己新建了包,出了以下错误 y.UnsatisfiedDependencyException: Error creating bean with name 'unM ...

  9. Filter 中注入失败问题

    参考: https://www.cnblogs.com/digdeep/p/4770004.html?tvd https://www.cnblogs.com/EasonJim/p/7666009.ht ...

随机推荐

  1. Vector3 *2 ,ToString()自动四舍五入

    还以为出错了,仔细看发现ToString()自动四舍五入 Vector3 forward = Camera.main.transform.forward; Debug.Log("forwar ...

  2. 创建简单的机器人模型smartcar

    前面我们使用的是已有的机器人模型进行仿真,这一节我们将建立一个简单的智能车机器人 smartcar,为后面建立复杂机器人打下基础. 一.创建硬件描述包. cd ~/catkin_ws/srcroscr ...

  3. uva10160 Servicing Stations

    The input consists of more than one description of town (but totally, less than ten descriptions). E ...

  4. luogu1328[NOIP2014 T1]生活大爆炸版石头剪刀布

    题目描述 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一样,则不分胜负.在<生活大爆炸>第二季第8 集中出现了一种石头剪刀布的升级版游戏. 升级版游戏在传统的 ...

  5. iOS 使用证书时遇到的错误一

    证书概念: 那么现在就牵扯到几个名词,Development证书,aps_Development证书(推送证书),测试描述文件,AppID,同理也就有Distribution证书,aps_Distri ...

  6. ip的划分,超详细

    from:http://blog.liuts.com/post/128/ IP和子网掩码我们都知道,IP是由四段数字组成,在此,我们先来了解一下3类常用的IP A类IP段 0.0.0.0 到127.2 ...

  7. wechat开发

    1.easywechat安装 2.weichat打通服务器 function getTest(Request $request){ $token = 'zhenhaokeji'; $data = $r ...

  8. MathType 公式后的空格问题

    注册表编辑器修改 Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Design Science\DSMT6\WordC ...

  9. mvc webapi 返回字符串自动加双引号

    来自:http://www.cnblogs.com/David-Huang/p/4351023.html 返回字符串,突然碰到双引号号问题,幸亏有人解决了. 返回XMLDocument类型,默认会解析 ...

  10. SQL Server之游标的基础知识

    什么是游标: 游标是可以在结果集中上下游动的指针. 游标的作用: --允许定位到结果集中的特定行. --从结果集的当前位置检索一行或多行数据. --支持对结果集中当前位置的行进行修改. 注意:游标虽然 ...