
uk.co.mruoc.promo.usecase.account.AccountPopulator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of burger-promo Show documentation
Show all versions of burger-promo Show documentation
Burger promotion backend apis
The newest version!
package uk.co.mruoc.promo.usecase.account;
import lombok.Builder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.core.Ordered;
import uk.co.mruoc.promo.entity.account.AccountFactory;
@Builder
@Slf4j
public class AccountPopulator implements ApplicationListener, Ordered {
private static final int NUMBER_TO_BUILD = 250000;
private final AccountFactory factory;
private final AccountService service;
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
log.info("clearing accounts...");
service.deleteAll();
log.info("creating {} accounts...", NUMBER_TO_BUILD);
service.saveAll(factory.buildAccounts(NUMBER_TO_BUILD));
log.info("created {} accounts", NUMBER_TO_BUILD);
}
@Override
public int getOrder() {
return 30;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy