srini s
srini s

Reputation: 1

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 ">

<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

Upvotes: 0

Views: 578

Answers (2)

Tanja
Tanja

Reputation: 131

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.*

Upvotes: 0

kriegaex
kriegaex

Reputation: 67457

Does it make any sense to XML-configure the aspect bean as LoggingAspect and then call your aspect class MyAspect?

Upvotes: 0

Related Questions