简体   繁体   English

Spring AOP-切入点不起作用

[英]Spring AOP - Pointcut Not working

I had created a pointcut. 我创建了一个切入点。 But it is not working. 但这是行不通的。 Please assist me on the below code. 请协助我处理以下代码。 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 "> 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 https://pastebin.com/Qi0cJkJJ

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

I think your problem is in the pointcut definition. 我认为您的问题出在切入点定义中。 You use 你用

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

but to define a pointcut in a package and all its subpackages (in your case: the implementation package), the syntax would be 但要在包及其所有子包中定义切入点(在您的情况下为实现包),则语法为

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

Note the two dots: bo..* instead of bo.* 请注意两个点: bo..*而不是bo.*

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

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