private int countEntities() { return toIntExact(dao.count()); }
@Override public void onApplicationEvent(ContextRefreshedEvent event) { if (event.getApplicationContext().equals(applicationContext)) { AlbumRepository albumRepository = BeanFactoryUtils.beanOfTypeIncludingAncestors(applicationContext, AlbumRepository.class); if (albumRepository != null && albumRepository.count() == 0) { populate(albumRepository); } } }