use of com.apistudy.restapi.accounts.AccountService in project spring-study by backtony.
the class AppConfig method applicationRunner.
// 그냥 스프링 뜰때 유저 하나 넣어준 거임
@Bean
public ApplicationRunner applicationRunner() {
return new ApplicationRunner() {
@Autowired
AccountService accountService;
@Autowired
AppProperties appProperties;
@Override
public void run(ApplicationArguments args) throws Exception {
Account admin = Account.builder().email(appProperties.getAdminUsername()).password(appProperties.getAdminPassword()).roles(Set.of(AccountRole.ADMIN, AccountRole.USER)).build();
accountService.saveAccount(admin);
Account user = Account.builder().email(appProperties.getUserUsername()).password(appProperties.getUserPassword()).roles(Set.of(AccountRole.USER)).build();
accountService.saveAccount(user);
}
};
}
Aggregations