Giriş
Şu satırı dahil ederiz
Örnekimport org.springframework.session.SessionRepository;
Şöyle yaparız
import org.springframework.session.MapSession; @Repository@RequiredArgsConstructorpublic class IgniteSessionRepository implements SessionRepository<MapSession> {private final SessionRepository sessionRepo;@Value("${sessions.maxInactiveInterval:1800}")private final long maxInactiveInterval;@Overridepublic MapSession createSession() {MapSession session = new MapSession();session.setMaxInactiveInterval(Duration.ofMinutes(maxInactiveInterval));return session;}@Overridepublic void save(MapSession session) {sessionRepo.save(session.getId(), session);}@Overridepublic MapSession findById(String id) {return sessionRepo.findById(id).orElseThrow();}@Overridepublic void deleteById(String id) {sessionRepo.deleteById(id);}}
Hiç yorum yok:
Yorum Gönder