Add spring-boot-starter-cache

Closes gh-3098
This commit is contained in:
Stephane Nicoll
2015-06-03 17:29:57 +02:00
parent 0ad0ad4c60
commit fca192fa41
9 changed files with 68 additions and 19 deletions

View File

@@ -16,16 +16,15 @@
package sample;
import javax.cache.annotation.CacheDefaults;
import javax.cache.annotation.CacheResult;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
@Component
@CacheDefaults(cacheName = "countries")
@CacheConfig(cacheNames = "countries")
public class CountryRepository {
@CacheResult
@Cacheable
public Country findByCode(String code) {
System.out.println("---> Loading country with code '" + code + "'");
return new Country(code);