(@cn.javass..Secure *) *(..) 任何返回值类型持有@cn.javass..Secure的方法不理解上面说的意思.我试着配了一下.但是一直不执行我的切面类.发下我的配置
<aop:before method="annotation"
pointcut="execution((@annotation.MyAnnotation *) *(..))"/>实现接口的类文件是: @Override
public MyAnnotation sayHelloAnnotation() {
System.out.println("after annotation");
return null;
}
切面类: public void annotation() {
System.out.println("before annotation");
}测试类: public class SpringTest { private static ClassPathXmlApplicationContext context;
@BeforeClass
public static void setUp() {
try {
context = new ClassPathXmlApplicationContext("bean.xml");
} catch(Exception e) {
e.printStackTrace();
}
}
@Test
public void test() {
try {
HelloApi ha = context.getBean("hello", HelloApi.class);
ha.sayHelloAnnotation();
} catch(Exception e) {
e.printStackTrace();
}
}}为什么我这么写不符合他说的呢??
<aop:before method="annotation"
pointcut="execution((@annotation.MyAnnotation *) *(..))"/>实现接口的类文件是: @Override
public MyAnnotation sayHelloAnnotation() {
System.out.println("after annotation");
return null;
}
切面类: public void annotation() {
System.out.println("before annotation");
}测试类: public class SpringTest { private static ClassPathXmlApplicationContext context;
@BeforeClass
public static void setUp() {
try {
context = new ClassPathXmlApplicationContext("bean.xml");
} catch(Exception e) {
e.printStackTrace();
}
}
@Test
public void test() {
try {
HelloApi ha = context.getBean("hello", HelloApi.class);
ha.sayHelloAnnotation();
} catch(Exception e) {
e.printStackTrace();
}
}}为什么我这么写不符合他说的呢??
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货