seb-server/src/main/java/ch/ethz/seb/sebserver/SEBServerInit.java

58 lines
2.1 KiB
Java
Raw Normal View History

2019-12-12 19:47:20 +01:00
/*
* Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET)
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package ch.ethz.seb.sebserver;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
2019-12-12 19:47:20 +01:00
import org.springframework.context.annotation.Lazy;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Lazy
@Component
public class SEBServerInit {
2020-04-27 12:17:10 +02:00
public static final Logger INIT_LOGGER = LoggerFactory.getLogger("ch.ethz.seb.SEB_SERVER_INIT");
2019-12-12 19:47:20 +01:00
private final Environment environment;
private final String version;
2019-12-12 19:47:20 +01:00
private boolean initialized = false;
protected SEBServerInit(
final Environment environment,
@Value("${sebserver.version}") final String version) {
2019-12-12 19:47:20 +01:00
this.environment = environment;
this.version = version;
2019-12-12 19:47:20 +01:00
}
public void init() {
if (!this.initialized) {
INIT_LOGGER.info("----> ___ ___ ___ ___ ");
INIT_LOGGER.info("----> / __|| __|| _ ) / __| ___ _ _ __ __ ___ _ _ ");
INIT_LOGGER.info("----> \\__ \\| _| | _ \\ \\__ \\/ -_)| '_|\\ V // -_)| '_|");
INIT_LOGGER.info("----> |___/|___||___/ |___/\\___||_| \\_/ \\___||_| ");
INIT_LOGGER.info("---->");
INIT_LOGGER.info("---->");
INIT_LOGGER.info("----> Version: {}", this.version);
2019-12-12 19:47:20 +01:00
INIT_LOGGER.info("---->");
INIT_LOGGER.info("----> Active profiles: {}", Arrays.toString(this.environment.getActiveProfiles()));
INIT_LOGGER.info("---->");
2021-04-30 13:32:22 +02:00
INIT_LOGGER.info("----> Context Path: {}", this.environment.getProperty("server.servlet.context-path"));
INIT_LOGGER.info("---->");
2019-12-12 19:47:20 +01:00
this.initialized = true;
}
}
}