Affects: \

@Cacheable @CacheEvict invalid

@service
pubic class TestService {

  @Cacheable(cacheNames ="user",key = "#userId")
  public User fetchUserById(Long userid) {
       return new User();
  }

  public User fetchCurrentUser() {
      return fetchUserById(124L);
  }

}

@Cacheable is valid, when I invoke fetchUserById(Long userid). @Cacheable is invalid, when I invoke fetchCurrentUser().

Comment From: bclozel

This is the expected and documented behavior:

The default advice mode for processing caching annotations is proxy, which allows for interception of calls through the proxy only. Local calls within the same class cannot get intercepted that way. For a more advanced mode of interception, consider switching to aspectj mode in combination with compile-time or load-time weaving.

Thanks!