title: Spring AOP AsjectJ annotations : define pointcut for multiple methods
body: <p>I have defined by advise to be executed for the two methods :</p>
  
  <p><strong>SampleBusinessLogicImpl.updateSample(Sample sample)</strong> and
  <strong>SampleBusinessLogicImpl.createSample(Sample sample)</strong></p>
  
  <p>But my advise get executed for the first update() method only.
  What am I doing wrong here ?</p>
  
  <pre><code>@Aspect
  public class SampleDynamicValidationAspect {
  
      private static final Logger logger = LoggerFactory.getLogger(SampleDynamicValidationAspect.class); 
  
      /**
      private SampleTblDAO dao; //DAOs can be used inside dynamic validations
      **/
  
  
      @Before("execution(public * com.rakuten.gep.sample.businesslogic.impl.SampleBusinessLogicImpl.updateSample(com.rakuten.gep.sample.entity.common.Sample,..)) &amp;&amp; args(sample,..) throws *Exception"
              +"|| execution(public * com.rakuten.gep.sample.businesslogic.impl.SampleBusinessLogicImpl.createSample(com.rakuten.gep.sample.entity.common.Sample,..)) &amp;&amp; args(sample,..) throws *Exception")
      public void validate(Sample sample) throws SampleException {
          //Dynamic validation here.
          //If some validation is failed, wrapped the appropiate exception in SampleException
          System.out.println("Involking Dynamic Validator");
      }
  }
  </code></pre>
  
  <p>My SampleBusinessLogicImpl class is as follows :</p>
  
  <pre><code>@Service
  public class SampleBusinessLogicImpl implements SampleBusinessLogic {
  
      @Autowired
      @Qualifier(value="proxySampleTblDao")
      private SampleTblDao sampleTblDao;
  
      @Override
      @Transactional(rollbackFor=Exception.class)
      public Sample createSample(Sample sample) throws SampleException {
          //..
      }
  
  
      @Override
      @Transactional(rollbackFor=Exception.class)
      public Sample updateSample(Sample sample) throws SampleException {
        //..
  
      }
  }
  </code></pre>