Spring3.1异常处理

异常一:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationService' defined in file [D:\developeProject\myeclipseTest\DBCenter\WebRoot\WEB-INF\classes\com\meta\dbcenter\application\service\impl\ApplicationServiceImpl.class]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: warning no match for this type name: id [Xlint:invalidAbsoluteTypeName]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)

原因1:

@Pointcut(value="execution(public * com.meta.dbcenter.application.service.impl.ApplicationServiceImpl.getApplicationById(*))")

    public void doGetApplication(){       

    }

@Before("doGetApplication(id)")
    public void beforeGetMethod(){
        System.out.println("beforeGetMethod()");
    }

原因2:

@Pointcut(value="execution(public * com.meta.dbcenter.application.service.impl.ApplicationServiceImpl.getApplicationById(*))")

    public void doGetApplication(String id){      //  不需要string id

    }

@Before("doGetApplication(id)")  //  不需要id
    public void beforeGetMethod(){
        System.out.println("beforeGetMethod()");
    }


异常二:

Multiple annotations found at this line:
    - Pointcut is malformed: warning no match for this type name: id [Xlint:invalidAbsoluteTypeName]
    - Pointcut is malformed: Pointcut is not well-formed: expecting '(' at character position 0 doGetApplication ^
    - Pointcut is malformed: Pointcut is not well-formed: expecting ')' at character position 92 execution(public *
     com.meta.dbcenter.application.service.impl.ApplicationServiceImpl.get*(*)&&(id)) ^^

原因1:

@Pointcut(value="execution(public * com.meta.dbcenter.application.service.impl.ApplicationServiceImpl.getApplicationById(*))&&args(id)") //使用args(id)不当

    public void doGetApplication(){       

    }


异常三:

org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'applicationService' must be of type [com.meta.dbcenter.application.service.impl.ApplicationServiceImpl], but was actually of type [com.sun.proxy.$Proxy7]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:360)

原因1:

使用了jdk的自动动态代理,需要在<aop:aspectj-autoproxy中添加proxy-target-class="true"   如下:

<aop:aspectj-autoproxy  proxy-target-class="true"/>   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值