업데이트 된 목록을 만들기 위해, 캐시의 목록에 대해 이야기 2,1 어제, 우리는 (allEntries = 진정한 가치 = "목록") 추가, 삭제, @CacheEvict를 추가하기 전에 방법을 변경해야

1  패키지 com.bw.service;
2  
 수입 은 java.util.List;
4  
5  수입 javax.annotation.Resource;
6  
7  수입 org.springframework.cache.annotation.CacheEvict;
8  수입 org.springframework.cache.annotation.Cacheable;
9  수입 org.springframework.stereotype.Service;
(10)  
(11)  수입 com.bw.entity.Student;
12  수입 com.bw.repository.StudentRepository;
13  수입 com.bw.utils.MD5Util;
14  
15  @Service
 16  공개 클래스 StudentService는 구현 IStudentService {
 17      @Resource 개인 StudentRepository studentRepository을;
18  
19      @Override
 20      @Cacheable (값 = "리스트" )
 21      공중 일람 <학생> 리스트 () {
 22          // TODO 방법 스텁을 자동 생성 
23          studentRepository.findAll ();
24      }
 25  
26      @Override
 27      @CacheEvict (값 = "목록"allEntries = )
 28      공중  무효저장 (학생 학생) {
 29          // TODO 자동 생성 방법 스텁 
(30)          student.setPwd (MD5Util.md5 (student.getPwd ()));
31          studentRepository.save (학생);
32      }
 33  
34      @Override
 35      공용 학생 로그인 (학생 학생) {
 36          // TODO 자동 생성 방법 스텁 
37          반환 studentRepository.findBySnameAndPwd (student.getSname () student.getPwd ());
38      }
 39  
40      @Override
 41      공용 학생 findBySname (문자열 SNAME) {
 42          //TODO 방법 스텁을 자동 생성 
43          studentRepository.findBySname (SNAME)를;
44      }
 45  
46      @Override
 47      공용 학생 findBySid (SID 문자열) {
 48          // TODO 방법 스텁을 자동 생성 
(49)          studentRepository.findBySid (SID);
50      }
 51  
52      
53  
54      
55  
56  
57  
58  
59  
60 }


추천

출처www.cnblogs.com/zwyzwy/p/11963042.html