moved caching to the Service layer

This commit is contained in:
Mic 2013-03-11 11:04:51 +08:00
parent e0ba8bfa74
commit 3fe122db45
3 changed files with 13 additions and 33 deletions

View file

@ -61,7 +61,6 @@ public class JdbcVetRepositoryImpl implements VetRepository {
* @see org.springframework.samples.petclinic.model.service.ClinicService#findVets()
*/
@Override
@Cacheable(value = "vets")
public Collection<Vet> findAll() throws DataAccessException {
List<Vet> vets = new ArrayList<Vet>();
// Retrieve the list of all vets.

View file

@ -18,6 +18,7 @@ package org.springframework.samples.petclinic.service;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.dao.DataAccessException;
import org.springframework.samples.petclinic.model.Owner;
import org.springframework.samples.petclinic.model.Pet;
@ -98,6 +99,7 @@ public class ClinicServiceImpl implements ClinicService {
@Override
@Transactional(readOnly = true)
@Cacheable(value = "vets")
public Collection<Vet> findVets() throws DataAccessException {
return vetRepository.findAll();
}