Package org.springframework.boot.builder

Examples of org.springframework.boot.builder.SpringApplicationBuilder


  @Autowired
  GMailProperties gmail;

  public static void main(String[] args) throws Exception {
    ConfigurableApplicationContext ctx =
        new SpringApplicationBuilder(FMail.class)
            .web(false)
            .run(args);
    System.out.println(ctx.getBean(FooService.class).foo("foo"));
    ctx.close();
  }
View Full Code Here


    context.close();
  }

  @Test
  public void testRawFileContents() {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(TestConfiguration.class);

    Properties p = new Properties();
    p.put("spring.yarn.client.localizer.rawFileContents." + SpringYarnBootUtils.escapeConfigKey("file1"), new byte[1]);
    p.put("spring.yarn.client.localizer.rawFileContents." + SpringYarnBootUtils.escapeConfigKey("file2"), new byte[2]);
    p.put("spring.yarn.client.localizer.rawFileContents." + SpringYarnBootUtils.escapeConfigKey("application.properties"), new byte[3]);
    builder.properties(p);

    SpringApplication app = builder.application();
    app.setWebEnvironment(false);
    ConfigurableApplicationContext context = app.run(new String[0]);
    SpringYarnClientLocalizerProperties properties = context.getBean(SpringYarnClientLocalizerProperties.class);
    assertThat(properties, notNullValue());
    assertThat(properties.getRawFileContents(), notNullValue());
View Full Code Here

    if (object instanceof ApplicationContext) {
      logger.info("Root context already created (using as parent).");
      parent = (ApplicationContext) object;
      servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, null);
    }
    SpringApplicationBuilder application = new SpringApplicationBuilder();
    if (parent != null) {
      application.initializers(new ParentContextApplicationContextInitializer(parent));
    }
    application.initializers(new ServletContextApplicationContextInitializer(servletContext));
    application.contextClass(AnnotationConfigEmbeddedWebApplicationContext.class);
    application = configure(application);
    // Ensure error pages are registered
    application.sources(ErrorFilter.class);
    return (WebApplicationContext) application.run();
  }
View Full Code Here

        URL url = new URL(baseUrl);
        if (url.getPath().endsWith("/")) {
          url = new URL(baseUrl.substring(0, baseUrl.length()-1));
        }
       
        ctx = new SpringApplicationBuilder()
          .showBanner(true)
          .headless(true)
          .logStartupInfo(false)
          .web(false)
          .registerShutdownHook(true)
View Full Code Here

          "Note:\n" +
          "  At least one option is mandatory."
      );
      System.exit(1);
    }
    new SpringApplicationBuilder(AmbariShell.class).showBanner(false).run(args);
  }
View Full Code Here

@Configuration
@RestController
public class CombinedApplication {

  public static void main(String[] args) {
    new SpringApplicationBuilder(ClientApplication.class, CombinedApplication.class).profiles("combined").run(args);
  }
View Full Code Here

@EnableOAuth2Client
@RestController
public class ClientApplication {

  public static void main(String[] args) {
    new SpringApplicationBuilder().profiles("client").sources(ClientApplication.class).run(args);
  }
View Full Code Here

  public SimpleModule(ModuleDescriptor descriptor, ModuleDeploymentProperties deploymentProperties,
      ClassLoader classLoader,
      ModuleOptions moduleOptions) {
    super(descriptor, deploymentProperties);
    this.moduleOptions = moduleOptions;
    application = new SpringApplicationBuilder().sources(PropertyPlaceholderAutoConfiguration.class)
        .web(false).showBanner(false);

    this.classLoader = classLoader;

    if (classLoader != null) {
View Full Code Here

    System.out.println(BannerUtils.displayBanner(getClass().getSimpleName(), null));

    try {
      ContainerBootstrapContext bootstrapContext = new ContainerBootstrapContext(new ContainerOptions());

      this.containerContext = new SpringApplicationBuilder(ContainerOptions.class, ParentConfiguration.class)
          .logStartupInfo(false)
          .profiles(XdProfiles.CONTAINER_PROFILE)
          .listeners(bootstrapContext.commandLineListener())
          .child(SharedServerContextConfiguration.class, ContainerOptions.class)
          .logStartupInfo(false)
View Full Code Here

    System.out.println(BannerUtils.displayBanner(getClass().getSimpleName(), null));

    ContainerBootstrapContext bootstrapContext = new ContainerBootstrapContext(new SingleNodeOptions());

    SpringApplicationBuilder admin = new SpringApplicationBuilder(SingleNodeOptions.class,
        ParentConfiguration.class)
        .logStartupInfo(false)
        .listeners(bootstrapContext.commandLineListener())
        .profiles(XdProfiles.ADMIN_PROFILE, XdProfiles.SINGLENODE_PROFILE)
        .initializers(new HsqldbServerProfileActivator())
        .child(SharedServerContextConfiguration.class, SingleNodeOptions.class)
        .logStartupInfo(false)
        .listeners(bootstrapContext.commandLineListener())
        .child(SingleNodeOptions.class, AdminServerApplication.class)
        .main(AdminServerApplication.class)
        .listeners(bootstrapContext.commandLineListener());
    admin.showBanner(false);
    admin.run(args);

    SpringApplicationBuilder container = admin
        .sibling(SingleNodeOptions.class, ContainerServerApplication.class)
        .logStartupInfo(false)
        .profiles(XdProfiles.CONTAINER_PROFILE, XdProfiles.SINGLENODE_PROFILE)
        .listeners(ApplicationUtils.mergeApplicationListeners(bootstrapContext.commandLineListener(),
            bootstrapContext.pluginContextInitializers()))
        .child(ContainerConfiguration.class)
        .main(ContainerServerApplication.class)
        .listeners(bootstrapContext.commandLineListener())
        .web(false);
    container.showBanner(false);
    container.run(args);

    adminContext = admin.context();

    containerContext = container.context();
    pluginContext = (ConfigurableApplicationContext) containerContext.getParent();

    return this;
  }
View Full Code Here

TOP

Related Classes of org.springframework.boot.builder.SpringApplicationBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.