Spring AOP拦截了一些公共方法而不是其他方法

时间:2017-03-20 15:50:38

标签: spring aspectj spring-aop

我在我的方面类中放置了拦截器

@Before("execution( * com.mycompany.a.service.weblab.b.doesTreatmentEqualsAndTrigger(..))"){
.........
}

这个拦截器工作正常,但当我放置这个拦截器

@Before("execution( * mycompany.a.b.bsf.c.requestReply(..))"){
............
}

代码未被拦截。

我的方面类在com.mycompany.x包中,我试图放置拦截器的函数都是{A}弹簧AOP所需的public

我的.xml如下:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"
    default-autowire="no">
    <context:annotation-config/>

    <aop:aspectj-autoproxy/>

    <bean name="com.a.serviceInterceptor" class="com.mycompany.x.RequestSpecificServiceAspect"/>

</beans>

为什么第二个功能没有被截获?因为它们没有任何共同之处,是因为它们的包装大不相同?如果是这样,我该如何解决这个问题?

0 个答案:

没有答案