spring3.0 带有参数的aspect解决思路
spring3.0 带有参数的aspect
首先我是跟着spring的文档来的
下面是我的的小测试,xml那里都是用annotation
这个是Prameter类的
测试类
异常:
Error create bean fail
can't find referenced pointcut showing
在spring community提问过了也无果- -!
这是怎么回事啊
------解决方案--------------------
没人回答 只能用马甲来拿分了
首先我是跟着spring的文档来的
- Java code
@Before("com.xyz.myapp.SystemArchitecture.dataAccessOperation() &&" + "args(account,..)") public void validateAccount(Account account) { // ... }
下面是我的的小测试,xml那里都是用annotation
- XML code
<aop:aspectj-autoproxy/> <context:component-scan base-package="com.spring.aop.ann"/>
- Java code
@Before("com.spring.aop.ann.service.Parameter.showing() && args(s,..)") public void needParameter(String s) { System.out.println("parameter is " + s); }
这个是Prameter类的
- Java code
@Component("parameter") public class Parameter { public void showing(String s) { System.out.println(s); } }
测试类
- Java code
@Test public void test2() { Parameter p = context.getBean("parameter", Parameter.class); p.showing("nagisa"); }
异常:
Error create bean fail
can't find referenced pointcut showing
在spring community提问过了也无果- -!
这是怎么回事啊
------解决方案--------------------
没人回答 只能用马甲来拿分了