@Aspect
public class AopMethod {
@Pointcut(
"execution(* com.xxx.spring.aop.service.SomeServiceWithNoInterface.*(..))")
public void pointCut() {
}
public void before() {
System.out.println(
"before");
}
public void after() {
System.out.println(
"after");
}
public void afterReturn() {
System.out.println(
"afterReturn");
}
@Around(
"pointCut()")
public Object
around(ProceedingJoinPoint pjp) {
Object result =
null;
try {
System.out.println(
"around before");
result = pjp.proceed();
System.out.println(
"around after");
}
catch (Throwable e) {
}
finally {
}
return result;
}
}
beans.xml
<aop:aspectj-autoproxy/>
其他代码都一样
转载请注明原文地址: https://ju.6miu.com/read-26369.html