Search in sources :

Example 81 with SpringApplication

use of org.springframework.boot.SpringApplication in project ontrack by nemerosa.

the class ShellApplication method main.

public static void main(String[] args) {
    SpringApplication application = new SpringApplication(ShellApplication.class);
    application.setBannerMode(Banner.Mode.OFF);
    ConfigurableApplicationContext context = application.run(args);
    context.getBeansOfType(Shell.class).get("shell").call(args);
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) SpringApplication(org.springframework.boot.SpringApplication)

Example 82 with SpringApplication

use of org.springframework.boot.SpringApplication in project ontrack by nemerosa.

the class Application method main.

/**
 * Start-up point
 *
 * @param args Arguments passed to the program, they may contain configuration variables.
 */
public static void main(String[] args) {
    // PID file
    File pid = new File("ontrack.pid");
    // Runs the application
    SpringApplication application = new SpringApplication(Application.class);
    application.addListeners(new ApplicationPidFileWriter(pid));
    application.run(args);
}
Also used : SpringApplication(org.springframework.boot.SpringApplication) ApplicationPidFileWriter(org.springframework.boot.system.ApplicationPidFileWriter) File(java.io.File)

Example 83 with SpringApplication

use of org.springframework.boot.SpringApplication in project chuidiang-ejemplos by chuidiang.

the class ClientMain method main.

public static void main(String[] args) {
    SpringApplication springApplication = new SpringApplication(ClientMain.class);
    springApplication.setWebApplicationType(WebApplicationType.NONE);
    springApplication.run(args);
}
Also used : SpringApplication(org.springframework.boot.SpringApplication)

Example 84 with SpringApplication

use of org.springframework.boot.SpringApplication in project atlasmap by atlasmap.

the class Application method main.

/**
 * The entry point.
 * @param args args
 */
public static void main(String[] args) {
    SpringApplication app = new SpringApplication(Application.class);
    ConfigurableApplicationContext context = app.run(args);
    String version = DefaultAtlasContextFactory.getInstance().getProperties().get(AtlasContextFactory.PROPERTY_ATLASMAP_CORE_VERSION);
    LOG.info("### AtlasMap Data Mapper UI {} started at port: {} ###", version, context.getEnvironment().getProperty("local.server.port"));
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) SpringApplication(org.springframework.boot.SpringApplication)

Example 85 with SpringApplication

use of org.springframework.boot.SpringApplication in project kylo by Teradata.

the class SparkShellApp method main.

/**
 * Instantiates the REST server with the specified arguments.
 *
 * @param args the command-line arguments
 */
public static void main(String[] args) {
    logger.info("Starting Kylo Spark Shell");
    final SpringApplication app = new SpringApplication(SparkShellApp.class);
    app.setAdditionalProfiles("kylo-shell");
    final Map<String, Object> properties = new HashMap<>();
    properties.put("kylo.client.id", System.getenv("KYLO_CLIENT_ID"));
    properties.put("kylo.client.secret", System.getenv("KYLO_CLIENT_SECRET"));
    app.setDefaultProperties(properties);
    // Ignore application listeners that will load kylo-services configuration
    final List<ApplicationListener<?>> listeners = FluentIterable.from(app.getListeners()).filter(Predicates.not(Predicates.or(Predicates.instanceOf(ConfigFileApplicationListener.class), Predicates.instanceOf(LoggingApplicationListener.class)))).toList();
    app.setListeners(listeners);
    // Start app
    final ApplicationContext context = app.run(args);
    if (logger.isInfoEnabled()) {
        logger.info("SparkLauncher Active Profiles = '{}'", Arrays.toString(context.getEnvironment().getActiveProfiles()));
    }
    // Keep main thread running until the idle timeout
    context.getBean(IdleMonitorService.class).awaitIdleTimeout();
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) IdleMonitorService(com.thinkbiganalytics.spark.service.IdleMonitorService) HashMap(java.util.HashMap) SpringApplication(org.springframework.boot.SpringApplication) ApplicationListener(org.springframework.context.ApplicationListener) ConfigFileApplicationListener(org.springframework.boot.context.config.ConfigFileApplicationListener) LoggingApplicationListener(org.springframework.boot.logging.LoggingApplicationListener)

Aggregations

SpringApplication (org.springframework.boot.SpringApplication)205 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)56 Test (org.junit.Test)43 Test (org.junit.jupiter.api.Test)39 Environment (org.springframework.core.env.Environment)21 ConfigurableEnvironment (org.springframework.core.env.ConfigurableEnvironment)15 HashMap (java.util.HashMap)9 ApplicationFailedEvent (org.springframework.boot.context.event.ApplicationFailedEvent)9 ApplicationReadyEvent (org.springframework.boot.context.event.ApplicationReadyEvent)9 ApplicationStartingEvent (org.springframework.boot.context.event.ApplicationStartingEvent)9 File (java.io.File)7 SpringApplicationBuilder (org.springframework.boot.builder.SpringApplicationBuilder)7 BeforeEach (org.junit.jupiter.api.BeforeEach)6 JavaLoggingSystem (org.springframework.boot.logging.java.JavaLoggingSystem)6 ApplicationContext (org.springframework.context.ApplicationContext)6 ApplicationPreparedEvent (org.springframework.boot.context.event.ApplicationPreparedEvent)5 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)5 Assertions.catchThrowable (org.assertj.core.api.Assertions.catchThrowable)4 JoranException (ch.qos.logback.core.joran.spi.JoranException)3 IOException (java.io.IOException)3