spring aop错误0:未绑定

spring aop错误0:未绑定,spring,spring-aop,Spring,Spring Aop,下面是我的方面 @Aspect public class TestAspect { @Around("execution (* com.test..*(..))") public void simonAspect(Joinpoint joinpoint) { System.out.println(" --- Interceptor --- "); } } xml文件是 <?xml version="1.0" encoding="UTF-8"?

下面是我的方面

@Aspect
public class TestAspect {

    @Around("execution (* com.test..*(..))")
    public void simonAspect(Joinpoint joinpoint) {
        System.out.println(" --- Interceptor --- ");

    }

}
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:mvc="http://www.springframework.org/schema/mvc"
    ... /schema/aop/spring-aop-3.0.xsd">

    <mvc:annotation-driven />

    <aop:aspectj-autoproxy />

    <context:component-scan base-package="com.test" />

    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/view/" />
        <property name="suffix" value=".jsp" />
    </bean>

    <bean class="com.test.aspect.TestAspect" />


</beans>

应该是

@Around("execution (* com.test.*(..))")
或者你可以像这样使用惠汀

@Around("within (* com.test.*)")

Around
方面希望您返回一个
对象

因此,您的方面方法应该更改为

@Around("execution (* com.test..*(..))")
public Object simonAspect(Joinpoint joinpoint) {
    System.out.println(" --- Interceptor --- ");

}

问题是我使用的是Joinpoint而不是Joinpoint。应来自org.aspectj.lang.*包的导入。

更改此文件时,我发现由以下原因导致的错误:java.lang.IllegalArgumentException:警告与此类型名称不匹配:com.test[Xlint:invalidabsolutionpename]
@Around("execution (* com.test..*(..))")
public Object simonAspect(Joinpoint joinpoint) {
    System.out.println(" --- Interceptor --- ");

}