summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/odiparpack/back/odiparback/student/studentConfig.java
blob: cd6668a486d4e343a9de03f6a1bddd2a708e31c2 (plain)
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
package com.odiparpack.back.odiparback.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 ana = new Student(
                    "Ana",
                    "ana@odiparpack.com",
                    LocalDate.of(2000, Month.JANUARY, 5)
            );

            Student bob = new Student(
                    "Bob",
                    "bob@odiparpack.com",
                    LocalDate.of(2000, Month.JANUARY, 5)
            );

            repository.saveAll(
                    List.of(ana, bob)
            );
        };

    }
}