title: Spring AOP Aspect not working using Mockito
body: <p>I have an <code>@Aspect</code> that weaves the execution of all my controller action methods. It works fine when I run the system, but not in unit testing. I'm using Mockito and junit in the following way:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration("file:**/spring-context.xml")
  @WebAppConfiguration
  public class UserControllerTest {        
      private MockMvc mockMvc;
  
      @Mock
      private RoleService roleService;
  
      @InjectMocks
      private UserController userController;
  
      @Before
      public void setUp() {
         MockitoAnnotations.initMocks(this);                    
         ...    
         mockMvc = MockMvcBuilders.standaloneSetup(userController).build();
      }    
      ...
  }
  </code></pre>
  
  <p>with some <code>@Test</code> using <code>mockMvc.perform()</code>.</p>
  
  <p>And my Aspect are:</p>
  
  <pre><code>@Pointcut("within(@org.springframework.stereotype.Controller *)")
  public void controller() { }
  
  @Pointcut("execution(* mypackage.controller.*Controller.*(..))")
  public void methodPointcut() { }
  
  @Around("controller() &amp;&amp; methodPointcut()")
  ...
  </code></pre>