cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

AOP Aspect not working

0 Likes
2,005

Hi All, I wrote an aspect to intercept customer model method. Here is the code. I don't see the aspect method getting called. Please correct me if i am doing wrong.

Aspect Class:

 @Aspect
 @Component
 public class CustomerCustomAspect{
 
     @Pointcut("execution(* de.hybris.platform.core.model.user.CustomerModel.getCard(..))") 
     public void theExample() {
         //
     }
     
         
     @Around("theExample()")
     public void getCard(ProceedingJoinPoint  joinPoint) throws Throwable {
         joinPoint.proceed();
         System.out.println("********************************came");
     }
     
 }

aop.xml:

 <weaver options="-Xset:weaveJavaxPackages=true">
     <include within="de.hybris.platform.core.model.user.." />
     <include within="src.myextension.core.customer.." />
 </weaver>
 <aspects>
     <aspect name="src.myextension.core.customer.CustomerCustomAspect" />
 </aspects>


local.properties -javaagent:./bin/platform/ext/core/lib/aspectjweaver-1.9.0.RC2.jar -Dorg.aspectj.tracing.enabled=false -Daj.weaving.verbose=false -Dorg.aspectj.weaver.showWeaveInfo=false

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Likes

Hello,

You may try to change Pointcut like below.

     @Pointcut("execution(* de.hybris.platform.core.model.user.CustomerModel*.getCard(..))") 

Former Member
0 Likes

Please provide point cut and expression="execution( de.hybris.platform.commercefacades.order.impl. .getCheckoutCart())" and try or else Use Runtime AOP :like

 <bean id='populateBillingAddressAspect' class="com.b2baddon.aop.AddBillingAddressToCartDataAspect" >
     <property name="cartService" ref="cartService"/>
     <property name="addressConverter" ref="addressConverter"/>
 </bean>
 <aop:config proxy-target-class="true">
     <aop:pointcut id="dataPopulatePoint"  expression="execution(* de.hybris.platform.commercefacades.order.impl.* .getCheckoutCart())" />
     <aop:aspect ref="populateBillingAddressAspect">
         <aop:around pointcut-ref="dataPopulatePoint" method="populate" />
     </aop:aspect>
 </aop:config>