@Test void should_reload_on_startup() { when(vehicleRepository.vehicles()).thenReturn(persistedVehicles); when(locationRepository.locations()).thenReturn(persistedLocations); reloadService.reload(event); verify(vehicleRepository).vehicles(); verify(vehicleService, times(persistedVehicles.size())).addVehicle(vehicle); verify(locationRepository).locations(); verify(locationService, times(persistedLocations.size())).addLocation(location); }
@EventListener public synchronized void reload(ApplicationStartedEvent event) { vehicleRepository.vehicles().forEach(vehicleService::addVehicle); locationRepository.locations().forEach(locationService::addLocation); }
ReloadService { @EventListener public synchronized void reload(ApplicationStartedEvent event) { vehicleRepository.vehicles().forEach(vehicleService::addVehicle); locationRepository.locations().forEach(locationService::addLocation); } }
ReloadService { @EventListener public synchronized void reload(ApplicationStartedEvent event) { vehicleRepository.vehicles().forEach(vehicleService::addVehicle); locationRepository.locations().forEach(locationService::addLocation); } @Autowired  ReloadService(
            VehicleRepository vehicleRepository,
            VehicleService vehicleService,
            LocationRepository locationRepository,
            LocationService locationService); }
ReloadService { @EventListener public synchronized void reload(ApplicationStartedEvent event) { vehicleRepository.vehicles().forEach(vehicleService::addVehicle); locationRepository.locations().forEach(locationService::addLocation); } @Autowired  ReloadService(
            VehicleRepository vehicleRepository,
            VehicleService vehicleService,
            LocationRepository locationRepository,
            LocationService locationService); @EventListener synchronized void reload(ApplicationStartedEvent event); }
ReloadService { @EventListener public synchronized void reload(ApplicationStartedEvent event) { vehicleRepository.vehicles().forEach(vehicleService::addVehicle); locationRepository.locations().forEach(locationService::addLocation); } @Autowired  ReloadService(
            VehicleRepository vehicleRepository,
            VehicleService vehicleService,
            LocationRepository locationRepository,
            LocationService locationService); @EventListener synchronized void reload(ApplicationStartedEvent event);  }