redis and spring boot code example

Example 1: spring boot redis example

Student retrievedStudent = 
  studentRepository.findById("Eng2015001").get();

Example 2: spring boot redis example

Student engStudent = new Student(
  "Eng2015001", "John Doe", Student.Gender.MALE, 1);
Student medStudent = new Student(
  "Med2015001", "Gareth Houston", Student.Gender.MALE, 2);
studentRepository.save(engStudent);
studentRepository.save(medStudent);

Example 3: spring boot redis example

studentRepository.deleteById(student.getId());

Example 4: spring boot redis example

List<Student> students = new ArrayList<>();
studentRepository.findAll().forEach(students::add);

Tags:

Java Example