Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It depends on what style of AOP you choose with Spring. As you stick with the annotation based approach, there is not much you can get except having constants for the expressions located in an extenal class.</p> <p>This is due to the @Aspect annotation based AOP style dedicated to colocate <em>where</em> and <em>what</em>. You can somehow get some configurability by using abstract method and binding the pointcut to it.</p> <pre><code>@Aspect public abstract class MyAspect { protected abstract pointcut(); @Before("pointcut()") public void myAdviceMethod() { // Advice code goes here } } public class ConcreteAspect extends MyAspect { @Pointcut("execution(* com.acme.*.*(..))") protected pointcut() { ) } </code></pre> <p>This is possible but seems rather awkward to me as the implementor has to know that <code>@Pointcut</code> is <em>required</em> on the method. If she forgets to place it, it will crash entirely.</p> <p>If you need the flexibility to have advice and pointcut separated you better stick to the XML based configuration (see <a href="http://static.springframework.org/spring/docs/2.5.x/reference/aop.html#aop-schema" rel="nofollow noreferrer">Spring documentation</a> for example).</p> <p>A kind of man in the middle is the possibility to tie your pointcut to a custom annotation and let the users decide where to place it and thus, when to get your advice applied. <a href="http://static.springframework.org/spring/docs/2.5.x/reference/aop.html#aop-pointcuts" rel="nofollow noreferrer">Spring documentation (chapter 6.2.3.4)</a> gives more info on that.</p> <p>Regards, Ollie</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload