SEBSLI-9 move init event below admin account create event

This commit is contained in:
Nadim Ritter 2024-03-18 13:57:42 +01:00
parent 4a97e8d32c
commit 32fc2817d4
2 changed files with 7 additions and 11 deletions

View file

@ -102,14 +102,16 @@ public class WebserviceInit implements ApplicationListener<ApplicationReadyEvent
SEBServerInit.INIT_LOGGER.info("----> Initialize Services...");
SEBServerInit.INIT_LOGGER.info("----> ");
this.applicationEventPublisher.publishEvent(new SEBServerInitEvent(this));
// Run the database integrity checks and fixes if configured
this.dbIntegrityChecker.checkIntegrity();
// Create an initial admin account if requested and not already in the database
this.adminUserInitializer.initAdminAccount();
//emits SEBServerInitEvent
this.applicationEventPublisher.publishEvent(new SEBServerInitEvent(this));
SEBServerInit.INIT_LOGGER.info("----> *********************************************************");
SEBServerInit.INIT_LOGGER.info("----> *** Webservice Info: ***");
SEBServerInit.INIT_LOGGER.info("----> *********************************************************");

View file

@ -3,19 +3,13 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.light.impl;
import ch.ethz.seb.sebserver.SEBServerInitEvent;
import ch.ethz.seb.sebserver.gbl.model.sebconfig.SEBClientConfig;
import ch.ethz.seb.sebserver.gbl.util.Result;
import ch.ethz.seb.sebserver.gbl.util.Utils;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.SEBClientConfigDAO;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.stream.Collectors;
@Lazy
@Service
@ -32,9 +26,9 @@ public class LightInit {
@EventListener(SEBServerInitEvent.class)
public void init() {
// if(isConnectionConfigAbsent()){
// this.sebClientConfigDAO.createNew(createLightConnectionConfiguration()).getOrThrow();
// }
if(isConnectionConfigAbsent()){
this.sebClientConfigDAO.createNew(createLightConnectionConfiguration()).getOrThrow();
}
}
private boolean isConnectionConfigAbsent() {