forked from DevFW-CICD/spring-petclinic
moved caching to the Service layer
This commit is contained in:
parent
e0ba8bfa74
commit
3fe122db45
3 changed files with 13 additions and 33 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue