Java 类org.springframework.boot.Banner.Mode 实例源码

项目:circus-train    文件:VacuumTool.java   
public static void main(String[] args) throws Exception {
  // below is output *before* logging is configured so will appear on console
  logVersionInfo();

  try {
    SpringApplication.exit(new SpringApplicationBuilder(VacuumTool.class)
        .properties("spring.config.location:${config:null}")
        .properties("spring.profiles.active:" + Modules.REPLICATION)
        .properties("instance.home:${user.home}")
        .properties("instance.name:${source-catalog.name}_${replica-catalog.name}")
        .bannerMode(Mode.OFF)
        .registerShutdownHook(true)
        .build()
        .run(args));
  } catch (BeanCreationException e) {
    if (e.getMostSpecificCause() instanceof BindException) {
      printVacuumToolHelp(((BindException) e.getMostSpecificCause()).getAllErrors());
    }
    throw e;
  }
}
项目:circus-train    文件:ComparisonTool.java   
public static void main(String[] args) throws Exception {
  // below is output *before* logging is configured so will appear on console
  logVersionInfo();

  try {
    SpringApplication.exit(new SpringApplicationBuilder(ComparisonTool.class)
        .properties("spring.config.location:${config:null}")
        .properties("spring.profiles.active:" + Modules.REPLICATION)
        .properties("instance.home:${user.home}")
        .properties("instance.name:${source-catalog.name}_${replica-catalog.name}")
        .bannerMode(Mode.OFF)
        .registerShutdownHook(true)
        .build()
        .run(args));
  } catch (BeanCreationException e) {
    if (e.getMostSpecificCause() instanceof BindException) {
      printComparisonToolHelp(((BindException) e.getMostSpecificCause()).getAllErrors());
      throw e;
    }
    if (e.getMostSpecificCause() instanceof IllegalArgumentException) {
      LOG.error(e.getMessage(), e);
      printComparisonToolHelp(Collections.<ObjectError> emptyList());
    }
  }
}
项目:circus-train    文件:FilterTool.java   
public static void main(String[] args) throws Exception {
  // below is output *before* logging is configured so will appear on console
  logVersionInfo();

  try {
    SpringApplication.exit(new SpringApplicationBuilder(FilterTool.class)
        .properties("spring.config.location:${config:null}")
        .properties("spring.profiles.active:" + Modules.REPLICATION)
        .properties("instance.home:${user.home}")
        .properties("instance.name:${source-catalog.name}_${replica-catalog.name}")
        .bannerMode(Mode.OFF)
        .registerShutdownHook(true)
        .build()
        .run(args));
  } catch (BeanCreationException e) {
    if (e.getMostSpecificCause() instanceof BindException) {
      printFilterToolHelp(((BindException) e.getMostSpecificCause()).getAllErrors());
    }
    throw e;
  }
}
项目:app-ms    文件:GatewayMS.java   
public static void main(final String[] args) {

        System.setProperty("vertx.disableDnsResolver", "true");
        System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory");

        final File logbackFile = new File("logback.xml");
        if (logbackFile.exists()) {
            System.setProperty("logging.config", logbackFile.getAbsolutePath());
        }

        final SpringApplication application = new SpringApplication(GatewayMS.class);
        application.setBannerMode(Mode.OFF);
        application.setWebEnvironment(false);
        application.run(args);

    }
项目:timely    文件:GetMetricTableSplitPoints.java   
public static void main(String[] args) throws Exception {

        try (ConfigurableApplicationContext ctx = new SpringApplicationBuilder(SpringBootstrap.class)
                .bannerMode(Mode.OFF).web(false).run(args)) {
            Configuration conf = ctx.getBean(Configuration.class);

            final BaseConfiguration apacheConf = new BaseConfiguration();
            Configuration.Accumulo accumuloConf = conf.getAccumulo();
            apacheConf.setProperty("instance.name", accumuloConf.getInstanceName());
            apacheConf.setProperty("instance.zookeeper.host", accumuloConf.getZookeepers());
            final ClientConfiguration aconf = new ClientConfiguration(Collections.singletonList(apacheConf));
            final Instance instance = new ZooKeeperInstance(aconf);
            Connector con = instance.getConnector(accumuloConf.getUsername(),
                    new PasswordToken(accumuloConf.getPassword()));
            Scanner s = con.createScanner(conf.getMetaTable(),
                    con.securityOperations().getUserAuthorizations(con.whoami()));
            try {
                s.setRange(new Range(Meta.METRIC_PREFIX, true, Meta.TAG_PREFIX, false));
                for (Entry<Key, Value> e : s) {
                    System.out.println(e.getKey().getRow().toString().substring(Meta.METRIC_PREFIX.length()));
                }
            } finally {
                s.close();
            }
        }
    }
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringApplication.java   
private Banner printBanner(ConfigurableEnvironment environment) {
    if (this.bannerMode == Banner.Mode.OFF) {
        return null;
    }
    if (printBannerViaDeprecatedMethod(environment)) {
        return null;
    }
    ResourceLoader resourceLoader = this.resourceLoader != null ? this.resourceLoader
            : new DefaultResourceLoader(getClassLoader());
    SpringApplicationBannerPrinter bannerPrinter = new SpringApplicationBannerPrinter(
            resourceLoader, this.banner);
    if (this.bannerMode == Mode.LOG) {
        return bannerPrinter.print(environment, this.mainApplicationClass, logger);
    }
    return bannerPrinter.print(environment, this.mainApplicationClass, System.out);
}
项目:eet.osslite.cz    文件:StartBackend.java   
public static void main(String[] cmdLineArgs) throws Exception {
    // String[] args = new String[cmdLineArgs.length + 1];
    // args[0] = "--debug";
    // System.arraycopy(cmdLineArgs, 0, args, 1, cmdLineArgs.length);

    SpringApplicationBuilder builder = new SpringApplicationBuilder(StartBackend.class);
    builder//
            .bannerMode(Mode.LOG)//
            // .sources(Start.class)//
            // .child(Main.class)//
            .logStartupInfo(true)//
            .registerShutdownHook(true)//
            .run(cmdLineArgs);
    // ConfigurableApplicationContext springContext = SpringApplication.run(Start.class, args);
    // springContext.registerShutdownHook();

    // ClassPathXmlApplicationContext ctx = new
    // ClassPathXmlApplicationContext("classpath*:spring/*.xml");
    //
    // // synchronized (Thread.currentThread()) {
    // // Thread.currentThread().wait();
    // // }
    // System.in.read();
    // ctx.close();
}
项目:eet.osslite.cz    文件:Main.java   
public static void main(String[] cmdLineArgs) throws Exception {
    if (cmdLineArgs.length < 2) {
        System.exit(1);
    }

    SpringApplicationBuilder builder = new SpringApplicationBuilder(Main.class);
    builder//
            .bannerMode(Mode.LOG)//
            // .sources(Main.class)//
            // .child(Main.class)//
            .registerShutdownHook(true)//
            .run();

    ConfigurableApplicationContext springContext = builder.context();

    Parser parser = springContext.getBean(Parser.class);

    Response rspObj = parser.parse(cmdLineArgs[0], cmdLineArgs[1]);

    ObjectMapper om = new ObjectMapper();
    String resp = om.writeValueAsString(rspObj);
    System.out.print(resp);

    System.exit(0);
}
项目:spring-boot-concourse    文件:SpringApplication.java   
private Banner printBanner(ConfigurableEnvironment environment) {
    if (this.bannerMode == Banner.Mode.OFF) {
        return null;
    }
    if (printBannerViaDeprecatedMethod(environment)) {
        return null;
    }
    ResourceLoader resourceLoader = this.resourceLoader != null ? this.resourceLoader
            : new DefaultResourceLoader(getClassLoader());
    SpringApplicationBannerPrinter bannerPrinter = new SpringApplicationBannerPrinter(
            resourceLoader, this.banner);
    if (this.bannerMode == Mode.LOG) {
        return bannerPrinter.print(environment, this.mainApplicationClass, logger);
    }
    return bannerPrinter.print(environment, this.mainApplicationClass, System.out);
}
项目:x-pipe    文件:RetryableRestOperationsTest.java   
@Test
public void retryableRestOperationsFailAndRetrySuccessTest() throws InterruptedException {
    ctx.close();
    RestOperations restOperations = RestTemplateFactory.createCommonsHttpRestTemplate(10, 100, 5000, 5000, 30,
            RetryPolicyFactories.newRestOperationsRetryPolicyFactory(100));
    Thread appStartThread = new Thread(new Runnable() {
        @Override
        public void run() {
            logger.info(remarkableMessage("New SpringApplication"));
            SpringApplication app2 = new SpringApplication(SimpleTestSpringServer.class);
            app2.setBannerMode(Mode.OFF);
            ctx = app2.run("");
            ctx.start();
        }
    });
    appStartThread.start();
    String response = restOperations.getForObject(generateRequestURL("/test"), String.class);
    assertEquals(targetResponse, response);
    appStartThread.join();
}
项目:taxii-log-adapter    文件:AdapterRunner.java   
/**
 * @param args The command line arguments.
 */
@SuppressFBWarnings(value="DM_DEFAULT_ENCODING", justification="DEV-NULL encoding is irrelevant")
public static void main(String[] args) {
    try (PrintStream devNull = new PrintStream(ByteStreams.nullOutputStream()))
    {
        System.setErr(devNull);
        ctx = new SpringApplicationBuilder(
                ScheduleConfiguration.class,
                RunNowConfiguration.class,
                SmokeTestConfiguration.class,
                RunConfigConfiguration.class)
            .bannerMode(Mode.OFF)
            .listeners(new ApplicationPidFileWriter())
            .web(false)
            .run(args);
        ctx.start();

    } catch (Throwable t) {
        errHandler.handle(t);
    }
}
项目:spring-cloud-commons    文件:RefreshEndpointTests.java   
@Test
public void keysComputedWhenChangesInExternalProperties() throws Exception {
    this.context = new SpringApplicationBuilder(Empty.class)
            .web(WebApplicationType.NONE).bannerMode(Mode.OFF)
            .properties("spring.cloud.bootstrap.name:none").run();
    RefreshScope scope = new RefreshScope();
    scope.setApplicationContext(this.context);
    TestPropertyValues
            .of("spring.cloud.bootstrap.sources="
                    + ExternalPropertySourceLocator.class.getName())
            .applyTo(this.context.getEnvironment(), Type.MAP, "defaultProperties");
    ContextRefresher contextRefresher = new ContextRefresher(this.context, scope);
    RefreshEndpoint endpoint = new RefreshEndpoint(contextRefresher);
    Collection<String> keys = endpoint.refresh();
    assertTrue("Wrong keys: " + keys, keys.contains("external.message"));
}
项目:spring-cloud-commons    文件:RefreshEndpointTests.java   
@Test
public void springMainSourcesEmptyInRefreshCycle() throws Exception {
    this.context = new SpringApplicationBuilder(Empty.class)
            .web(WebApplicationType.NONE).bannerMode(Mode.OFF)
            .properties("spring.cloud.bootstrap.name:none").run();
    RefreshScope scope = new RefreshScope();
    scope.setApplicationContext(this.context);
    // spring.main.sources should be empty when the refresh cycle starts (we don't
    // want any config files from the application context getting into the one used to
    // construct the environment for refresh)
    TestPropertyValues
            .of("spring.main.sources="
                    + ExternalPropertySourceLocator.class.getName())
            .applyTo(this.context);
    ContextRefresher contextRefresher = new ContextRefresher(this.context, scope);
    RefreshEndpoint endpoint = new RefreshEndpoint(contextRefresher);
    Collection<String> keys = endpoint.refresh();
    assertFalse("Wrong keys: " + keys, keys.contains("external.message"));
}
项目:spring-cloud-cli    文件:DeployerApplication.java   
private DeployerProperties loadCloudProperties() {

        final ConfigurableApplicationContext context = new SpringApplicationBuilder(
                PropertyPlaceholderAutoConfiguration.class, DeployerConfiguration.class)
                        .bannerMode(Mode.OFF).logStartupInfo(false).web(false)
                        .properties("spring.config.name=cloud", "logging.level.ROOT=OFF",
                                "spring.cloud.launcher.list=true",
                                "launcher.version=" + getVersion())
                        .run(this.args);
        try {
            return context.getBean(DeployerProperties.class);
        }
        finally {
            context.close();
        }
    }
项目:spring-cloud-config    文件: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);
    builder.web(WebApplicationType.NONE).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();
    }
}
项目:eds    文件:Application.java   
public static void main(String[] args) {
    new SpringApplicationBuilder()
            .listeners(new EnvironmentPrepareListener())
            .sources(Application.class)
            .bannerMode(Mode.CONSOLE)
            .build()
            .run(args);
}
项目:chimera    文件:JPosApplication.java   
protected static void run(Class cls, String[] args)
{
    SpringHolder.setArgs(args);
    Q2Mods.patchQ2();

    System.setProperty("spring.config.location", "file:cfg/");
    SpringApplication app = new SpringApplication(JPosApplication.class, cls);
    app.setBannerMode(Mode.OFF);
    app.run(args);
}
项目:app-ms    文件:Microservice.java   
/**
 * Bootstrap the microservice application.
 *
 * @param applicationClass
 *            JAX-RS Application class
 * @param extraSources
 *            extra source classes.
 * @param args
 *            command line arguments
 */
public static void run(final Class<? extends Application> applicationClass,
    final Class<?>[] extraSources,
    final String... args) {

    if (!microserviceEngineIterator.hasNext()) {
        throw new LinkageError("No MicroserviceEngine was defined");
    }
    final MicroserviceEngine microserviceEngine = microserviceEngineIterator.next();
    if (microserviceEngineIterator.hasNext()) {
        throw new LinkageError(format("Multiple MicroserviceEngine was defined, %s, %s and possibly more", microserviceEngine, microserviceEngineIterator.next()));
    }
    if (Microservice.applicationClass != null) {
        throw new LinkageError("Another Application class has already been registered in this JVM.");
    }
    Microservice.applicationClass = applicationClass;

    final Object[] bootstrapObjects = microserviceEngine.bootstrap();
    final Object[] sources = new Object[extraSources.length + bootstrapObjects.length];

    System.arraycopy(extraSources, 0, sources, 0, extraSources.length);
    System.arraycopy(bootstrapObjects, 0, sources, extraSources.length, bootstrapObjects.length);

    final SpringApplication springApplication = new SpringApplication(sources);
    springApplication.setWebEnvironment(false);
    springApplication
        .setBannerMode(Mode.OFF);
    springApplication.run(args);
}
项目:interview-preparation    文件:BootApplication.java   
public static void main(String args[]) {
    final SpringApplication application = new SpringApplication(BootApplication.class);
    final Properties properties = new Properties();
    properties.put("server.servletPath", "/api/*");// dispatch-servlet path can be set here
    application.setBannerMode(Mode.CONSOLE);
    application.setDefaultProperties(properties);
    application.run();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:BannerTests.java   
@Test
public void testDisableBannerInContext() throws Exception {
    SpringApplication application = new SpringApplication(Config.class);
    application.setBannerMode(Mode.OFF);
    application.setWebEnvironment(false);
    this.context = application.run();
    assertThat(this.context.containsBean("springBootBanner")).isFalse();
}
项目:eet.osslite.cz    文件:StartWebApi.java   
public static void main(String[] cmdLineArgs) throws Exception {
    LoggerFactory.getILoggerFactory();

    new SpringApplicationBuilder(StartWebApi.class)//
            .bannerMode(Mode.LOG)//
            .logStartupInfo(true)//
            .registerShutdownHook(true)//
            .headless(true)//
            .run(cmdLineArgs);
}
项目:spring-boot-concourse    文件:BannerTests.java   
@Test
public void testDisableBannerInContext() throws Exception {
    SpringApplication application = new SpringApplication(Config.class);
    application.setBannerMode(Mode.OFF);
    application.setWebEnvironment(false);
    this.context = application.run();
    assertThat(this.context.containsBean("springBootBanner")).isFalse();
}
项目:x-pipe    文件:TestMetaServer.java   
@Override
public void doStart() throws Exception{

    System.setProperty(DefaultDcMetaCache.MEMORY_META_SERVER_DAO_KEY, configFile);
    System.setProperty("TOTAL_SLOTS", String.valueOf(total_slots));

    SpringApplication application = new SpringApplication(TestMetaServer.class);
    application.setBannerMode(Mode.OFF);
    application.setEnvironment(createEnvironment());

    context = application.run(new String[]{});

    TestZkClient client = context.getBean(TestZkClient.class);
    DefaultZkConfig zkConfig = new DefaultZkConfig();
    zkConfig.setZkSessionTimeoutMillis(zkSessionTimeoutMillis);
    client.setZkConfig(zkConfig);
    client.setZkAddress(zkConnectionStr);

    UnitTestServerConfig config = context.getBean(UnitTestServerConfig.class);
    config.setZkAddress(zkConnectionStr);
    config.setMetaServerId(serverId);
    config.setMetaServerPort(serverPort);

    ArrangeTaskTrigger arrangeTaskTrigger = context.getBean(ArrangeTaskTrigger.class);
    arrangeTaskTrigger.setWaitForRestartTimeMills(waitForRestartTimeMills);

    manager = context.getBean(SpringComponentRegistry.class);
    manager.initialize();
    manager.start();
}
项目:x-pipe    文件:RetryableRestOperationsTest.java   
@Before
public void startUp() {
    port = randomPort(8081, 9090);
    targetResponse = randomString();
    System.setProperty("server.port", String.valueOf(port));
    System.setProperty("target-response", targetResponse);
    SpringApplication app = new SpringApplication(SimpleTestSpringServer.class);
    app.setBannerMode(Mode.OFF);
    ctx = app.run("");
    ctx.start();
}
项目:spring-cloud-function    文件:ApplicationRunner.java   
public ConfigurableApplicationContext start(String... args) {
    return new SpringApplicationBuilder(ApplicationRunner.class).web(false)
            .contextClass(AnnotationConfigApplicationContext.class)
            .bannerMode(Mode.OFF).properties("spring.main.applicationContextClass="
                    + AnnotationConfigApplicationContext.class.getName())
            .run(args);
}
项目:sdcct    文件:SdcctApplicationConfiguration.java   
public static SdcctApplication buildApplication() {
    ResourceLoader resourceLoader = new DefaultResourceLoader();
    ResourcePatternResolver resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);

    SdcctApplication app = ((SdcctApplication) new SdcctApplicationBuilder(buildSources(resourcePatternResolver)).addCommandLineProperties(false)
        .bannerMode(Mode.OFF).headless(true).resourceLoader(resourceLoader).application());

    app.setPropertySource(buildPropertySource(resourcePatternResolver));

    app.setListeners(
        app.getListeners().stream().filter((appListener -> !appListener.getClass().equals(LoggingApplicationListener.class))).collect(Collectors.toList()));

    return app;
}
项目:spring-cloud-stream    文件:AggregateApplicationUtils.java   
protected static SpringApplicationBuilder embedApp(
        ConfigurableApplicationContext parentContext, String namespace,
        Class<?> app) {
    return new SpringApplicationBuilder(app).web(WebApplicationType.NONE).main(app).bannerMode(Mode.OFF)
            .properties("spring.jmx.default-domain=" + namespace)
            .properties(
                    InternalPropertyNames.NAMESPACE_PROPERTY_NAME + "=" + namespace)
            .registerShutdownHook(false).parent(parentContext);
}
项目:spring-cloud-commons    文件:RefreshEndpointTests.java   
@Test
public void keysComputedWhenAdded() throws Exception {
    this.context = new SpringApplicationBuilder(Empty.class)
            .web(WebApplicationType.NONE).bannerMode(Mode.OFF)
            .properties("spring.cloud.bootstrap.name:none").run();
    RefreshScope scope = new RefreshScope();
    scope.setApplicationContext(this.context);
    context.getEnvironment().setActiveProfiles("local");
    ContextRefresher contextRefresher = new ContextRefresher(this.context, scope);
    RefreshEndpoint endpoint = new RefreshEndpoint(contextRefresher);
    Collection<String> keys = endpoint.refresh();
    assertTrue("Wrong keys: " + keys, keys.contains("added"));
}
项目:spring-cloud-commons    文件:RefreshEndpointTests.java   
@Test
public void keysComputedWhenOveridden() throws Exception {
    this.context = new SpringApplicationBuilder(Empty.class)
            .web(WebApplicationType.NONE).bannerMode(Mode.OFF)
            .properties("spring.cloud.bootstrap.name:none").run();
    RefreshScope scope = new RefreshScope();
    scope.setApplicationContext(this.context);
    context.getEnvironment().setActiveProfiles("override");
    ContextRefresher contextRefresher = new ContextRefresher(this.context, scope);
    RefreshEndpoint endpoint = new RefreshEndpoint(contextRefresher);
    Collection<String> keys = endpoint.refresh();
    assertTrue("Wrong keys: " + keys, keys.contains("message"));
}
项目:spring-cloud-commons    文件:RefreshEndpointTests.java   
@Test
public void eventsPublishedInOrder() throws Exception {
    this.context = new SpringApplicationBuilder(Empty.class)
            .web(WebApplicationType.NONE).bannerMode(Mode.OFF).run();
    RefreshScope scope = new RefreshScope();
    scope.setApplicationContext(this.context);
    ContextRefresher contextRefresher = new ContextRefresher(this.context, scope);
    RefreshEndpoint endpoint = new RefreshEndpoint(contextRefresher);
    Empty empty = this.context.getBean(Empty.class);
    endpoint.refresh();
    int after = empty.events.size();
    assertEquals("Shutdown hooks not cleaned on refresh", 2, after);
    assertTrue(empty.events.get(0) instanceof EnvironmentChangeEvent);
}
项目:spring-cloud-commons    文件:RefreshEndpointTests.java   
@Test
public void shutdownHooksCleaned() {
    ConfigurableApplicationContext context = new SpringApplicationBuilder(Empty.class)
            .web(WebApplicationType.NONE).bannerMode(Mode.OFF).run();
    RefreshScope scope = new RefreshScope();
    scope.setApplicationContext(context);
    ContextRefresher contextRefresher = new ContextRefresher(context, scope);
    RefreshEndpoint endpoint = new RefreshEndpoint(contextRefresher);
    int count = countShutdownHooks();
    endpoint.refresh();
    int after = countShutdownHooks();
    assertEquals("Shutdown hooks not cleaned on refresh", count, after);
}
项目:spring-advanced-training    文件:RestApplication.java   
public static void main(String[] args) {
    // SpringApplication.run(RestApplication.class, args);
    SpringApplication app = new SpringApplication(RestApplication.class);
    // it is also configurable in YML (as spring.main.banner-mode)
    app.setBannerMode(Mode.OFF);
    app.run(args);
}
项目:scouter-pulse-aws-monitor    文件:ScouterPulseApplication.java   
public static void main(String[] args) {
        SpringApplication app = new SpringApplication(ScouterPulseApplication.class);
        app.setBannerMode(Mode.OFF);
        app.run(args);
}
项目:easycode    文件:Application.java   
public static ConfigurableApplicationContext run(SpringApplication application, String[] args) {
    ConfigurableApplicationContext context = null;
    try {
        Assert.notNull(application);
        //禁用SpringBoot Banner
        String disableBanner = System.getProperty(BOOT_BANNER_DISABLE_KEY);
        if (disableBanner == null || disableBanner.equals("true")) {
            application.setBannerMode(Mode.OFF);
        }
        context = application.run(args);
        //注册关闭服务钩子
        if (!application.isWebEnvironment() &&
                "true".equals(context.getEnvironment().getProperty(SPRING_APP_WAIT_KEY))) {
            Runtime.getRuntime().addShutdownHook(new Thread() {
                public void run() {
                    synchronized (Application.class) {
                        running = false;
                        Application.class.notify();
                    }
                }
            });
        }
    } catch (Exception e) {
        e.printStackTrace();
        log.error("Application startup error.", e);
        System.exit(1);
    }
    if (!application.isWebEnvironment() &&
            "true".equals(context.getEnvironment().getProperty(SPRING_APP_WAIT_KEY))) {
        synchronized (Application.class) {
            while (running) {
                try {
                    Application.class.wait();
                } catch (Throwable ignored) {

                }
            }
        }
    }
    return context;
}
项目:hawkbit-examples    文件:Application.java   
public static void main(final String[] args) {
    new SpringApplicationBuilder().bannerMode(Mode.OFF).sources(Application.class).run(args);
}
项目:example-springboot    文件:Application.java   
public static void main(String[] args) {

    SpringApplication app = new SpringApplication(Application.class);
    app.setBannerMode(Mode.OFF);
    app.run(args);
  }
项目:spring-cloud-stream    文件:DefaultBinderFactory.java   
@SuppressWarnings("unchecked")
private <T> Binder<T, ?, ?> getBinderInstance(String configurationName) {
    if (!this.binderInstanceCache.containsKey(configurationName)) {
        BinderConfiguration binderConfiguration = this.binderConfigurations.get(configurationName);
        Assert.state(binderConfiguration != null, "Unknown binder configuration: " + configurationName);
        BinderType binderType = this.binderTypeRegistry.get(binderConfiguration.getBinderType());
        Assert.notNull(binderType, "Binder type " + binderConfiguration.getBinderType() + " is not defined");
        Map<Object, Object> binderProperties = binderConfiguration.getProperties();
        // Convert all properties to arguments, so that they receive maximum
        // precedence
        ArrayList<String> args = new ArrayList<>();
        for (Map.Entry<Object, Object> property : binderProperties.entrySet()) {
            args.add(String.format("--%s=%s", property.getKey(), property.getValue()));
        }
        // Initialize the domain with a unique name based on the bootstrapping context
        // setting
        ConfigurableEnvironment environment = this.context != null ? this.context.getEnvironment() : null;
        String defaultDomain = environment != null ? environment.getProperty("spring.jmx.default-domain.") : "";
        args.add("--spring.jmx.default-domain=" + defaultDomain + "binder." + configurationName);
        args.add("--spring.main.applicationContextClass=" + AnnotationConfigApplicationContext.class.getName());
        SpringApplicationBuilder springApplicationBuilder = new SpringApplicationBuilder()
                .sources(binderType.getConfigurationClasses())
                .bannerMode(Mode.OFF)
                .logStartupInfo(false)
                .web(WebApplicationType.NONE);
        // If the environment is not customized and a main context is available, we
        // will set the latter as parent.
        // This ensures that the defaults and user-defined customizations (e.g. custom
        // connection factory beans)
        // are propagated to the binder context. If the environment is customized,
        // then the binder context should
        // not inherit any beans from the parent
        boolean useApplicationContextAsParent = binderProperties.isEmpty() && this.context != null;
        if (useApplicationContextAsParent) {
            springApplicationBuilder.parent(this.context);
        }
        if (environment != null && (useApplicationContextAsParent || binderConfiguration.isInheritEnvironment())) {
            StandardEnvironment binderEnvironment = new StandardEnvironment();
            binderEnvironment.merge(environment);
            springApplicationBuilder.environment(binderEnvironment);
        }
        ConfigurableApplicationContext binderProducingContext = springApplicationBuilder
                .run(args.toArray(new String[args.size()]));
        Binder<T, ?, ?> binder = binderProducingContext.getBean(Binder.class);
        if (!CollectionUtils.isEmpty(this.listeners)) {
            for (Listener binderFactoryListener : listeners) {
                binderFactoryListener.afterBinderContextInitialized(configurationName, binderProducingContext);
            }
        }
        this.binderInstanceCache.put(configurationName, new SimpleImmutableEntry<>(binder, binderProducingContext));
    }
    return (Binder<T, ?, ?>) this.binderInstanceCache.get(configurationName).getKey();
}
项目:spring-cloud-commons    文件:ContextRefresher.java   
ConfigurableApplicationContext addConfigFilesToEnvironment() {
    ConfigurableApplicationContext capture = null;
    try {
        StandardEnvironment environment = copyEnvironment(
                this.context.getEnvironment());
        SpringApplicationBuilder builder = new SpringApplicationBuilder(Empty.class)
                .bannerMode(Mode.OFF).web(WebApplicationType.NONE)
                .environment(environment);
        // Just the listeners that affect the environment (e.g. excluding logging
        // listener because it has side effects)
        builder.application()
                .setListeners(Arrays.asList(new BootstrapApplicationListener(),
                        new ConfigFileApplicationListener()));
        capture = builder.run();
        if (environment.getPropertySources().contains(REFRESH_ARGS_PROPERTY_SOURCE)) {
            environment.getPropertySources().remove(REFRESH_ARGS_PROPERTY_SOURCE);
        }
        MutablePropertySources target = this.context.getEnvironment()
                .getPropertySources();
        String targetName = null;
        for (PropertySource<?> source : environment.getPropertySources()) {
            String name = source.getName();
            if (target.contains(name)) {
                targetName = name;
            }
            if (!this.standardSources.contains(name)) {
                if (target.contains(name)) {
                    target.replace(name, source);
                }
                else {
                    if (targetName != null) {
                        target.addAfter(targetName, source);
                    }
                    else {
                        // targetName was null so we are at the start of the list
                        target.addFirst(source);
                        targetName = name;
                    }
                }
            }
        }
    }
    finally {
        ConfigurableApplicationContext closeable = capture;
        while (closeable != null) {
            try {
                closeable.close();
            }
            catch (Exception e) {
                // Ignore;
            }
            if (closeable.getParent() instanceof ConfigurableApplicationContext) {
                closeable = (ConfigurableApplicationContext) closeable.getParent();
            }
            else {
                break;
            }
        }
    }
    return capture;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringApplication.java   
/**
 * Sets the mode used to display the banner when the application runs. Defaults to
 * {@code Banner.Mode.CONSOLE}.
 * @param bannerMode the mode used to display the banner
 */
public void setBannerMode(Banner.Mode bannerMode) {
    this.bannerMode = bannerMode;
}
项目:spring-boot-concourse    文件:SpringApplication.java   
/**
 * Sets the mode used to display the banner when the application runs. Defaults to
 * {@code Banner.Mode.CONSOLE}.
 * @param bannerMode the mode used to display the banner
 */
public void setBannerMode(Banner.Mode bannerMode) {
    this.bannerMode = bannerMode;
}