Example usage for org.springframework.boot.builder SpringApplicationBuilder run

List of usage examples for org.springframework.boot.builder SpringApplicationBuilder run

Introduction

In this page you can find the example usage for org.springframework.boot.builder SpringApplicationBuilder run.

Prototype

public ConfigurableApplicationContext run(String... args) 

Source Link

Document

Create an application context (and its parent if specified) with the command line args provided.

Usage

From source file:de.zalando.awsqueen.awqaccinfo.AccinfoApplication.java

public static void main(final String[] args) {
    final SpringApplicationBuilder app = new SpringApplicationBuilder(AccinfoApplication.class);
    app.showBanner(false);/*from   w  w  w.j  a v  a  2 s . co  m*/
    app.properties("spring.cloud.bootstrap.enabled=false", "logging.level.ROOT=WARN");
    app.run(args);
}

From source file:de.zalando.spring.cloud.config.aws.kms.test.TestApplication.java

public static void main(final String[] args) {
    final SpringApplicationBuilder app = new SpringApplicationBuilder(TestApplication.class);
    app.showBanner(false);//  w w w .  j av  a 2 s  .  com
    app.properties("spring.cloud.bootstrap.enabled=false", "logging.level.ROOT=WARN");
    app.run(args);
}

From source file:com.github.bfour.fpliteraturecollector.application.Application.java

public static void main(String[] args) {

    try {/*ww  w . j  a  v  a  2s.co m*/

        // https://vvirlan.wordpress.com/2014/12/10/solved-caused-by-java-awt-headlessexception-when-trying-to-create-a-swingawt-frame-from-spring-boot/
        SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
        builder.headless(false);
        ConfigurableApplicationContext context = builder.run(args);

        // Neo4jResource myBean = context.getBean(Neo4jResource.class);
        // myBean.functionThatUsesTheRepo();

        // ServiceManager servMan = ServiceManager
        // .getInstance(ServiceManagerMode.TEST);
        ServiceManager servMan = context.getBean(ServiceManager.class);
        context.getAutowireCapableBeanFactory().autowireBeanProperties(servMan,
                AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, true);

        FPJGUIManager.getInstance().initialize();

        MainWindow.getInstance(servMan).setVisible(true);

    } catch (BeanCreationException e) {
        e.printStackTrace();
        if (ExceptionUtils.getRootCause(e) instanceof IOException)
            ApplicationErrorDialogue.showMessage("Sorry, could not access the database.\n"
                    + "This might be because it is currently in use or because there are insufficient access rights.\n"
                    + "Try closing all running instances of this application and restart.");
        else
            ApplicationErrorDialogue.showDefaultMessage(e, BUG_REPORT_URL);
    } catch (Exception e) {
        e.printStackTrace();
        ApplicationErrorDialogue.showDefaultMessage(e, BUG_REPORT_URL);
    }

}

From source file:com.blackducksoftware.integration.hub.detect.Application.java

public static void main(final String[] args) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
    builder.logStartupInfo(false);/*  w w  w . jav  a  2  s.c  om*/
    builder.run(args);
}

From source file:org.obiba.mica.Application.java

/**
 * Main method, used to run the application.
 * <p/>/* www  . j  ava  2 s . c  o  m*/
 * To run the application with hot reload enabled, add the following arguments to your JVM:
 * "-javaagent:spring_loaded/springloaded-jhipster.jar -noverify -Dspringloaded=plugins=io.github.jhipster.loaded.instrument.JHipsterLoadtimeInstrumentationPlugin"
 */
public static void main(String... args) {

    checkSystemProperty("MICA_HOME");

    SpringApplicationBuilder app = new SpringApplicationBuilder(Application.class).bannerMode(Banner.Mode.OFF);

    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);

    // Check if the selected profile has been set as argument.
    // if not the development profile will be added
    addDefaultProfile(app, source);

    app.run(args);
}

From source file:org.springframework.cloud.config.server.environment.NativeEnvironmentRepository.java

@Override
public Environment findOne(String config, String profile, String label) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(PropertyPlaceholderAutoConfiguration.class);
    ConfigurableEnvironment environment = getEnvironment(profile);
    builder.environment(environment);/* ww w .j a  v a2  s.c o  m*/
    builder.web(false).bannerMode(Mode.OFF);
    if (!logger.isDebugEnabled()) {
        // Make the mini-application startup less verbose
        builder.logStartupInfo(false);
    }
    String[] args = getArgs(config, profile, label);
    // Explicitly set the listeners (to exclude logging listener which would change
    // log levels in the caller)
    builder.application().setListeners(Arrays.asList(new ConfigFileApplicationListener()));
    ConfigurableApplicationContext context = builder.run(args);
    environment.getPropertySources().remove("profiles");
    try {
        return clean(new PassthruEnvironmentRepository(environment).findOne(config, profile, label));
    } finally {
        context.close();
    }
}

From source file:org.springframework.cloud.config.server.NativeEnvironmentRepository.java

@Override
public Environment findOne(String config, String profile, String label) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(PropertyPlaceholderAutoConfiguration.class);
    ConfigurableEnvironment environment = getEnvironment(profile);
    builder.environment(environment);//from  w  ww  .j  a va 2s.c  o m
    builder.web(false).showBanner(false);
    String[] args = getArgs(config, label);
    // Explicitly set the listeners (to exclude logging listener which would change
    // log levels in the caller)
    builder.application().setListeners(Collections.singletonList(new ConfigFileApplicationListener()));
    ConfigurableApplicationContext context = builder.run(args);
    environment.getPropertySources().remove("profiles");
    try {
        return clean(new PassthruEnvironmentRepository(environment).findOne(config, profile, label));
    } finally {
        context.close();
    }
}