繁体   English   中英

Spring AOP-切入点不起作用

[英]Spring AOP - Pointcut Not working

我创建了一个切入点。 但这是行不通的。 请协助我处理以下代码。 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring- aop-3.0.xsd “>

<aop:aspectj-autoproxy />

<bean id="customerBo" class="com.mkyong.customer.bo.impl.CustomerBoImpl" />

<!-- Aspect -->
<bean id="logAspect" class="com.mkyong.aspect.LoggingAspect" />

https://pastebin.com/Qi0cJkJJ

将方面bean XML配置为LoggingAspect ,然后将您的方面类MyAspect吗?

我认为您的问题出在切入点定义中。 你用

 @Pointcut("within(com.mkyong.customer.bo.*)")
 public void checkMyDetails() {}

但要在包及其所有子包中定义切入点(在您的情况下为实现包),则语法为

 @Pointcut("within(com.mkyong.customer.bo..*)")
 public void checkMyDetails() {}

请注意两个点: bo..*而不是bo.*

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM