-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentConfig.java
More file actions
36 lines (31 loc) · 1016 Bytes
/
StudentConfig.java
File metadata and controls
36 lines (31 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.example.apiapplicationNEW.student;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.time.LocalDate;
import java.time.Month;
import java.util.List;
@Configuration
public class StudentConfig {
@Bean
CommandLineRunner commandLineRunner(StudentRepository repository){
return args -> {
Student akshat = new Student(
1L,
"Akshat",
"akshat@gmail.com",
LocalDate.of(2003, Month.JULY, 4),
21
);
Student alex = new Student(
"alex",
"alex@gmail.com",
LocalDate.of(2003, Month.JANUARY, 14),
21
);
repository.saveAll(
List.of(akshat,alex)
);
};
}
}