/
NikolayIvkin
/
tutorials1
Обзор
Документация
Войти
/
NikolayIvkin
/
tutorials1
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
spring-boot-modules/spring-boot-react/src/main/java/com/baeldung/springbootreact/BoostrapInitialData.java
27 строк
850 B
Sallo Szrajbman
BAEL-4842 - Use React and Spring Boot to Build a Simple CRUD App
28 мар 2021, 19:00
28 мар 2021, 19:00
14bf673
Код
Авторство
О чём код?
package com.baeldung.springbootreact; import com.baeldung.springbootreact.domain.Client; import com.baeldung.springbootreact.repository.ClientRepository; import com.github.javafaker.Faker; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; import java.util.Locale; @Component public class BoostrapInitialData implements CommandLineRunner { private final ClientRepository clientRepository; private final Faker faker = new Faker(Locale.getDefault()); public BoostrapInitialData(ClientRepository clientRepository) { this.clientRepository = clientRepository; } @Override public void run(String... args) { for (int i = 0; i < 10; i++) { clientRepository.save(new Client(faker.name().fullName(), faker.internet().emailAddress())); } } }