package ru.ulstu; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import ru.ulstu.configuration.ApplicationProperties; import ru.ulstu.core.repository.JpaDetachableRepositoryImpl; @SpringBootApplication @EnableJpaRepositories(repositoryBaseClass = JpaDetachableRepositoryImpl.class) public class NgTrackerApplication { private final ApplicationProperties applicationProperties; public NgTrackerApplication(ApplicationProperties applicationProperties) { this.applicationProperties = applicationProperties; } public static void main(String[] args) { SpringApplication.run(NgTrackerApplication.class, args); } @EventListener(ApplicationReadyEvent.class) public void doSomethingAfterStartup() { System.out.println("hello world, I have just started up"); if (applicationProperties.isCheckRun()) { System.exit(0); } } }