Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Service
@Profile("default")
public class DatabaseLoader {
private final PageRepository pageRepository;
private final PortalRepository portalRepository;
@Autowired
public DatabaseLoader(PageRepository pageRepository, PortalRepository portalRepository) {
this.pageRepository = pageRepository;
this.portalRepository = portalRepository;
}
@PostConstruct
private void initDatabase() {
Portal portal = new Portal("ABN AMRO Retail Banking");
portalRepository.save(portal);
Page page = new Page();
page.setName("login");
page.setPortal(portal);
pageRepository.save(page);
page = new Page();
page.setName("accounts");
page.setPortal(portal);
pageRepository.save(page);
page = new Page();
page.setName("profile");
page.setPortal(portal);
pageRepository.save(page);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.