BAEL-19967: Migrate spring-caching module to the com.baeldung package

This commit is contained in:
Krzysiek
2019-12-18 21:31:15 +01:00
parent 9df9e5b068
commit 1e15094846
18 changed files with 31 additions and 31 deletions

View File

@@ -0,0 +1,21 @@
package com.baeldung.caching.example;
import com.baeldung.caching.model.Book;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class BookService {
@Cacheable(value="books", keyGenerator="customKeyGenerator")
public List<Book> getBooks() {
List<Book> books = new ArrayList<Book>();
books.add(new Book(1, "The Counterfeiters", "André Gide"));
books.add(new Book(2, "Peer Gynt and Hedda Gabler", "Henrik Ibsen"));
return books;
}
}