November 2017
Intermediate to advanced
542 pages
14h 24m
English
With the JPA implementation, we used the data.sql file to initialize the data in our database. For MongoDB implementation, we can remove the data.sql file and replace it with a Java configuration file, which we will call MongoDataInitializer.java:
//src/main/java/com/packtpub/springsecurity/configuration/ MongoDataInitializer.java … @Configuration public class MongoDataInitializer { @Autowired private RoleRepository roleRepository; @Autowired private CalendarUserRepository calendarUserRepository; @Autowired private EventRepository eventRepository; @PostConstruct public void setUp() { calendarUserRepository.deleteAll(); roleRepository.deleteAll(); eventRepository.deleteAll(); seedRoles(); seedCalendarUsers(); ...Read now
Unlock full access