title: Spring AOP Pointcut for Spring Data Rest Controller (EndPoint)
body: <p>I would like to do something on every api call to my spring boot app. I use Spring AOP to achieve this. Using:</p>
  <pre><code>@Pointcut(&quot;within(@org.springframework.stereotype.Controller *)&quot;)
  public void controller() {
  }
  
  @Pointcut(&quot;within(@org.springframework.web.bind.annotation.RestController *)&quot;)
  public void restController() {
  }
  
  @After(&quot;(controller() || restController())&quot;)
  public void loggingAdvice(JoinPoint joinPoint) {
     // TODO: do something
  }
  </code></pre>
  <p>Using that I can get all the event when API is being called. However, I am also using spring rest data for crud mechanism that automatically generate API end point, for example:</p>
  <pre><code>@RepositoryRestResource(collectionResourceRel = &quot;users&quot;, path = &quot;users&quot;)
  public interface UserRepository extends PagingAndSortingRepository&lt;User, Long&gt; {
      User findByEmail(String email);
  }
  </code></pre>
  <p>The question is, can I create a point cut for every API end point that is generated by spring rest data?</p>