#389 - Polishing.

Add author tags. Reformat code.

Original pull request: #412.
This commit is contained in:
Mark Paluch
2018-09-19 15:49:25 +02:00
parent 2828e352fa
commit 02ee909aa7
2 changed files with 4 additions and 3 deletions

View File

@@ -24,11 +24,12 @@ import org.springframework.data.repository.CrudRepository;
* *
* @author Oliver Gierke * @author Oliver Gierke
* @author Thomas Darimont * @author Thomas Darimont
* @author Andrea Rizzini
*/ */
public interface CachingUserRepository extends CrudRepository<User, Long> { public interface CachingUserRepository extends CrudRepository<User, Long> {
@Override @Override
@CacheEvict(value="byUsername", key="#p0.username") @CacheEvict(value = "byUsername", key = "#p0.username")
<S extends User> S save(S entity); <S extends User> S save(S entity);
@Cacheable("byUsername") @Cacheable("byUsername")

View File

@@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
* *
* @author Oliver Gierke * @author Oliver Gierke
* @author Thomas Darimont * @author Thomas Darimont
* @author Andrea Rizzini
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@Transactional @Transactional
@@ -56,13 +57,12 @@ public class CachingRepositoryTests {
assertThat(cache.get("dmatthews").get()).isEqualTo(dave); assertThat(cache.get("dmatthews").get()).isEqualTo(dave);
} }
@Test @Test
public void checkCacheEviction() { public void checkCacheEviction() {
User dave = new User(); User dave = new User();
dave.setUsername("dmatthews"); dave.setUsername("dmatthews");
dave = repository.save(dave); repository.save(dave);
// Verify entity evicted on cache // Verify entity evicted on cache
Cache cache = cacheManager.getCache("byUsername"); Cache cache = cacheManager.getCache("byUsername");