Java 类org.springframework.boot.builder.SpringApplicationBuilder 实例源码

项目:spring-io    文件:ApplicationWebXml.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    /**
     * set a default to use when no profile is configured.
     */
    DefaultProfileUtil.addDefaultProfile(application.application());
    return application.sources(StoreApp.class);
}
项目:SkyEye    文件:Launcher.java   
public static void main(String[] args) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
    Set<ApplicationListener<?>> listeners = builder.application().getListeners();
    for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
        ApplicationListener<?> listener = it.next();
        if (listener instanceof LoggingApplicationListener) {
            it.remove();
        }
    }
    builder.application().setListeners(listeners);
    ConfigurableApplicationContext context = builder.run(args);
    LOGGER.info("collector backup start successfully");

    KafkaConsumer kafkaConsumer = (KafkaConsumer<byte[], String>) context.getBean("kafkaConsumer");
    Task task = (Task) context.getBean("backupTask");

    // 优雅停止项目
    Runtime.getRuntime().addShutdownHook(new ShutdownHookRunner(kafkaConsumer, task));
    task.doTask();
}
项目: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());
    }
  }
}
项目:spring-security-oauth2-boot    文件:ResourceServerTokenServicesConfigurationTests.java   
@Test
public void useRemoteTokenServices() {
    TestPropertyValues.of("security.oauth2.resource.tokenInfoUri:http://example.com")
            .applyTo(this.environment);
    this.context = new SpringApplicationBuilder(ResourceConfiguration.class)
            .environment(this.environment).web(WebApplicationType.NONE).run();
    RemoteTokenServices services = this.context.getBean(RemoteTokenServices.class);
    assertThat(services).isNotNull();
}
项目:spring-security-oauth2-boot    文件:ResourceServerTokenServicesConfigurationTests.java   
@Test
public void switchToUserInfo() {
    TestPropertyValues.of("security.oauth2.resource.userInfoUri:http://example.com")
            .applyTo(this.environment);
    this.context = new SpringApplicationBuilder(ResourceConfiguration.class)
            .environment(this.environment).web(WebApplicationType.NONE).run();
    UserInfoTokenServices services = this.context
            .getBean(UserInfoTokenServices.class);
    assertThat(services).isNotNull();
}
项目:spring-security-oauth2-boot    文件:ResourceServerTokenServicesConfigurationTests.java   
@Test
public void userInfoWithAuthorities() {
    TestPropertyValues.of("security.oauth2.resource.userInfoUri:http://example.com")
            .applyTo(this.environment);
    this.context = new SpringApplicationBuilder(AuthoritiesConfiguration.class)
            .environment(this.environment).web(WebApplicationType.NONE).run();
    UserInfoTokenServices services = this.context
            .getBean(UserInfoTokenServices.class);
    assertThat(services).isNotNull();
    assertThat(services).extracting("authoritiesExtractor")
            .containsExactly(this.context.getBean(AuthoritiesExtractor.class));
}
项目:xm-ms-entity    文件:ApplicationWebXml.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    /**
     * set a default to use when no profile is configured.
     */
    DefaultProfileUtil.addDefaultProfile(application.application());
    return application.sources(EntityApp.class);
}
项目:xm-ms-balance    文件:ApplicationWebXml.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    /**
     * set a default to use when no profile is configured.
     */
    DefaultProfileUtil.addDefaultProfile(application.application());
    return application.sources(BalanceApp.class);
}
项目:fdk-java    文件:SpringCloudFunctionInvoker.java   
/**
 * A common pattern is to call this function from within a Configuration method of
 * a {@link org.springframework.beans.factory.annotation.Configurable} function.
 *
 * @param configClass The class which defines your Spring Cloud Function @Beans
 */
public SpringCloudFunctionInvoker(Class<?> configClass) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(configClass);
    applicationContext = builder.web(false).run();
    loader = applicationContext.getAutowireCapableBeanFactory().createBean(SpringCloudFunctionLoader.class);
    loader.loadFunction();
}
项目:spring-security-oauth2-boot    文件:ResourceServerTokenServicesConfigurationTests.java   
@Test
public void jwkTokenStoreShouldBeConditionalOnMissingBean() throws Exception {
    TestPropertyValues
            .of("security.oauth2.resource.jwk.key-set-uri=http://my-auth-server/token_keys")
            .applyTo(this.environment);
    this.context = new SpringApplicationBuilder(JwkTokenStoreConfiguration.class,
            ResourceConfiguration.class).environment(this.environment)
                    .web(WebApplicationType.NONE).run();
    assertThat(this.context.getBeansOfType(JwkTokenStore.class)).hasSize(1);
}
项目:spring-security-oauth2-boot    文件:ResourceServerTokenServicesConfigurationTests.java   
@Test
public void jwtTokenStoreShouldBeConditionalOnMissingBean() throws Exception {
    TestPropertyValues.of("security.oauth2.resource.jwt.keyValue=" + PUBLIC_KEY)
            .applyTo(this.environment);
    this.context = new SpringApplicationBuilder(JwtTokenStoreConfiguration.class,
            ResourceConfiguration.class).environment(this.environment)
                    .web(WebApplicationType.NONE).run();
    assertThat(this.context.getBeansOfType(JwtTokenStore.class)).hasSize(1);
}
项目:MTC_Labrat    文件:ApplicationWebXml.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    /**
     * set a default to use when no profile is configured.
     */
    DefaultProfileUtil.addDefaultProfile(application.application());
    return application.sources(LabratApp.class);
}
项目:BittrexGatherer    文件:BittrexGathererApplication.java   
public static void main(String[] args) {
    SpringApplication springApplication = new SpringApplicationBuilder()
        .sources(BittrexGathererApplication.class)
        .web(false)
        .build();

springApplication.run();

  }
项目:SkyEye    文件:Application.java   
public static void main(String[] args) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
    Set<ApplicationListener<?>> listeners = builder.application().getListeners();
    for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
        ApplicationListener<?> listener = it.next();
        if (listener instanceof LoggingApplicationListener) {
            it.remove();
        }
    }
    builder.application().setListeners(listeners);
    builder.run(args);

    LOGGER.info("接口A start successfully");
}
项目:SkyEye    文件:Launcher.java   
public static void main(String[] args) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
    Set<ApplicationListener<?>> listeners = builder.application().getListeners();
    for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
        ApplicationListener<?> listener = it.next();
        if (listener instanceof LoggingApplicationListener) {
            it.remove();
        }
    }
    builder.application().setListeners(listeners);
    builder.run(args);

    LOGGER.info("服务C start successfully");

    // 优雅停止项目
    Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override
        public void run() {
            LOGGER.info("try to stop the system");
            synchronized (Launcher.class) {
                RUNNING = false;
                Launcher.class.notify();
            }
        }
    });

    synchronized (Launcher.class) {
        while (RUNNING) {
            try {
                Launcher.class.wait();
            } catch (InterruptedException e) {
                LOGGER.error("wait error");
                e.printStackTrace();
            }
        }
    }
}
项目:Microservices-with-JHipster-and-Spring-Boot    文件:ApplicationWebXml.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {

    /**
     * set a default to use when no profile is configured.
     */
    DefaultProfileUtil.addDefaultProfile(application.application());
    return application.sources(JHipsterRegistry.class);
}
项目:spring-io    文件:ApplicationWebXml.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    /**
     * set a default to use when no profile is configured.
     */
    DefaultProfileUtil.addDefaultProfile(application.application());
    return application.sources(SpringIoApp.class);
}
项目:cas-5.1.0    文件:CasConfigurationServerServletInitializer.java   
@Override
protected SpringApplicationBuilder configure(final SpringApplicationBuilder builder) {
    return builder
            .sources(CasConfigurationServerWebApplication.class)
            .banner(new CasConfigurationServerBanner())
            .logStartupInfo(true);
}
项目:cas-5.1.0    文件:CasWebApplication.java   
/**
 * Main entry point of the CAS web application.
 *
 * @param args the args
 */
public static void main(final String[] args) {
    final Map<String, Object> properties = CasEmbeddedContainerUtils.getRuntimeProperties(Boolean.TRUE);
    final Banner banner = CasEmbeddedContainerUtils.getCasBannerInstance();
    new SpringApplicationBuilder(CasWebApplication.class)
            .banner(banner)
            .web(true)
            .properties(properties)
            .logStartupInfo(true)
            .contextClass(CasWebApplicationContext.class)
            .run(args);
}
项目:SkyEye    文件:Application.java   
public static void main(String[] args) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
    Set<ApplicationListener<?>> listeners = builder.application().getListeners();
    for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
        ApplicationListener<?> listener = it.next();
        if (listener instanceof LoggingApplicationListener) {
            it.remove();
        }
    }
    builder.application().setListeners(listeners);
    builder.run(args);

    LOGGER.info("web start successfully");
}
项目:DiscussionPortal    文件:ServletInitializer.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(DiscussionPortalApplication.class);
}
项目:document-management-store-app    文件:LocalDmApp.java   
public static void main(String[] args) {
    new SpringApplicationBuilder()
            .sources(DmApp.class)
            .profiles("local")
            .run();
}
项目:ApplicationDetection    文件:Application.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(Application.class);
}
项目:SensitiveWordFilter    文件:ServletInitializer.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
    return builder.sources(SensitivewordfilterApplication.class);
}
项目:spring-cloud-samples    文件:CustomerApplication.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(CustomerApplication.class);
}
项目:spring-boot-seed    文件:ServletInitializer.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(Application.class);
}
项目:miscroServiceHello    文件:SleuthApplication.java   
public static void main(String[] args) {
    new SpringApplicationBuilder(SleuthApplication.class).run(args);
}
项目:Spring-Security-Third-Edition    文件:CalendarApplication.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(CalendarApplication.class);
}
项目:pay-xxpay-master    文件:XxPayGatewayApplication.java   
public static void main(String[] args) {
    new SpringApplicationBuilder(XxPayGatewayApplication.class).web(true).run(args);
}
项目:MicroServiceProject    文件:Application.java   
public static void main(String[] args) {
       new SpringApplicationBuilder(Application.class).web(true).run(args);
}
项目:apollo-custom    文件:ConfigServiceApplication.java   
public static void main(String[] args) throws Exception {
  ConfigurableApplicationContext context =
      new SpringApplicationBuilder(ConfigServiceApplication.class).run(args);
  context.addApplicationListener(new ApplicationPidFileWriter());
  context.addApplicationListener(new EmbeddedServerPortFileWriter());
}
项目:Spring-Security-Third-Edition    文件:CalendarApplication.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(CalendarApplication.class);
}
项目:airsonic    文件:Application.java   
public static void main(String[] args) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder();
    doConfigure(builder).run(args);
}
项目:mafia    文件:MafiaApiStartup.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
    return builder.sources(this.getClass());
}
项目:Spring-Security-Third-Edition    文件:CalendarApplication.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(CalendarApplication.class);
}
项目:xxpay-master    文件:XxPayGatewayApplication.java   
public static void main(String[] args) {
    new SpringApplicationBuilder(XxPayGatewayApplication.class).web(true).run(args);
}
项目:popular-movie-store    文件:MyMovieStoreApp.java   
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(MyMovieStoreApp.class);
}
项目:miscroServiceHello    文件:ZuulApplication.java   
public static void main(String[] args) {
    new SpringApplicationBuilder(ZuulApplication.class).web(true).run(args);
}
项目:iStudent    文件:ServletInitializer.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(IStudentApplication.class);
}
项目:DanmuChat    文件:ServletInitializer.java   
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    setRegisterErrorPageFilter(false);
    return application.sources(AlphaApplication.class);
}