This discussion is archived
0 Replies Latest reply: Aug 13, 2013 8:10 AM by vikram04g RSS

AOP JoinPoint not getting executed

vikram04g Newbie
Currently Being Moderated

The spring configuration that I have is

<beans xmlns=""

  xmlns:xsi="" xmlns:aop=""

  xsi:schemaLocation=" ">



  <aop:aspectj-autoproxy />



  <bean id="addCarrierService" class="com.service.AddCarrierService" />



  <!-- Aspect -->

  <bean id="authorizeBeforeAspect" class="com.custom.AuthorizeBeforeAspect" />






  <aop:aspect id="aspectLoggging" ref="authorizeBeforeAspect">



  <!-- @Before -->

  <aop:pointcut id="pointCutBefore" expression="execution(* com.service.*.*(..))" />



  <aop:before method="secureBefore" pointcut-ref="pointCutBefore" />








And the join point class is

package com.custom;



import org.aspectj.lang.JoinPoint;

import org.aspectj.lang.annotation.Aspect;


import org.springframework.stereotype.Component;





public class AuthorizeBeforeAspect {




  public void secureBefore(JoinPoint joinPoint) {

  System.out.println("Inside AuthorizeBeforeAspect.secureBefore() method");

  if (SecurityContextHolder.getContext().getAuthentication().getPrincipal() != null)


  DEPUser user = (DEPUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();






AuthorizeBeforeAspect .java class does not get executed at all. Not sure where am I going wrong?


  • Correct Answers - 10 points
  • Helpful Answers - 5 points