启用了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. Windows系统小知识

    前言 本文写作于Window10发布后的2015-08-01,新系统发布后我做了新系统的小白鼠,所以写此文以作记录. WIN10各版本下载地址:http://www.ithome.com/html/w ...

  2. 升级Flash Builder 4.6中的Flash Player版本

    测试有效 本人按此方法升级到了flash player 15 Adobe自发布Flash Builder 4.6后,就暂停了Flash Builder新版本的发布.但AIR和FlashPlayer版本 ...

  3. [No000057]一个人默默背单词,小心被传染哦

    不日凛冬将至,全国各地,已有多名少侠因季节变化,出现了不同程度的四肢不勤.bd不分的症状.具体表现为—— 包大人在此高能预警:不想背单词,有可能你已经被传染了. 好好的,怎么突然不想背单词了 哈佛医学 ...

  4. 如何调试shell脚本

    今天看shell脚本攻略的时候,看见这个方法,感觉还是不错的 #!/bin/bash function DEBUG(){ [[ $_DEBUG == 'on' ]] && $@ || ...

  5. ES6 .Set数据结构去除重复元素

    用法一 var set = new Set([1, 2, 3, 4, 2, 8, 4]); //两个2 for (var elem of set) { console.log(elem) // 输出结 ...

  6. MySQL数据库的优化(下)MySQL数据库的高可用架构方案

    MySQL数据库的优化(下)MySQL数据库的高可用架构方案 2011-03-09 08:53 抚琴煮酒 51CTO 字号:T | T 在上一篇MySQL数据库的优化中,我们跟随笔者学习了单机MySQ ...

  7. 04传智_jbpm与OA项目_部门模块改进_直接在BaseAction中实现ModelDriven<T>

    这个项目是用Struts2做的,我这里单独写了一个BaseAction,用来存放所有的功能模块的Action的公共部分, 刚开始的做法是这个BaseAction只会继承ActionSupport 并不 ...

  8. BZOJ 1010 【HNOI2008】 玩具装箱toy

    Description P教授要去看奥运,但是他舍不下他的玩具,于是他决定把所有的玩具运到北京.他使用自己的压缩器进行压缩,其可以将任意物品变成一堆,再放到一种特殊的一维容器中.P教授有编号为1... ...

  9. How To Create an IE-Only Stylesheet

    https://css-tricks.com/how-to-create-an-ie-only-stylesheet/ https://css-tricks.com/snippets/css/css- ...

  10. oracle:db-link使用

    二个oracle instance,如果需要在一个instance上,直接查询另一个instance上的数据,就要用到db-link 创建: create public database link 链 ...