Search in sources :

Example 76 with SpringApplicationBuilder

use of org.springframework.boot.builder.SpringApplicationBuilder in project ratauth by alfa-laboratory.

the class RatAuthServerTest method registerAndRefresh.

private void registerAndRefresh(Class<?> configClass, String... properties) {
    HashMap<String, Object> mergedPropsMap = mergePropertiesWithDefault(properties);
    context = new SpringApplicationBuilder(configClass).web(false).properties(mergedPropsMap).profiles("local").run();
}
Also used : SpringApplicationBuilder(org.springframework.boot.builder.SpringApplicationBuilder)

Example 77 with SpringApplicationBuilder

use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-cloud-gcp by spring-cloud.

the class SecretManagerBootstrapConfigurationTests method configurationDisabled.

@Test
public void configurationDisabled() {
    SpringApplicationBuilder disabledConfigurationApp = new SpringApplicationBuilder(TestBootstrapConfiguration.class, GcpSecretManagerBootstrapConfiguration.class).properties("spring.cloud.gcp.secretmanager.project-id=" + PROJECT_NAME).properties("spring.cloud.gcp.secretmanager.enabled=false").web(WebApplicationType.NONE);
    try (ConfigurableApplicationContext c = disabledConfigurationApp.run()) {
        String secret = c.getEnvironment().getProperty("sm://my-secret");
        assertThat(secret).isEqualTo(null);
    }
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) SpringApplicationBuilder(org.springframework.boot.builder.SpringApplicationBuilder) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 78 with SpringApplicationBuilder

use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-cloud-gcp by spring-cloud.

the class GcpConfigIntegrationTests method testConfiguration.

@Test
public void testConfiguration() {
    this.context = new SpringApplicationBuilder().sources(GcpContextAutoConfiguration.class, GcpConfigBootstrapConfiguration.class).web(WebApplicationType.NONE).properties("spring.cloud.gcp.config.enabled=true", "spring.application.name=myapp", "spring.profiles.active=dontexist,prod").run();
    assertThat(this.context.getEnvironment().getProperty("myapp.queue-size")).isEqualTo("200");
    assertThat(this.context.getEnvironment().getProperty("myapp.feature-x-enabled")).isEqualTo("true");
}
Also used : SpringApplicationBuilder(org.springframework.boot.builder.SpringApplicationBuilder) Test(org.junit.Test)

Example 79 with SpringApplicationBuilder

use of org.springframework.boot.builder.SpringApplicationBuilder in project proxyee-down by monkeyWie.

the class DownApplication method initRest.

private void initRest() {
    // init rest server config
    HttpDownRestCallback.setCallback(new HttpDownAppCallback());
    RestWebServerFactoryCustomizer.init(null);
    ServerConfigInfo serverConfigInfo = ConfigContent.getInstance().get();
    serverConfigInfo.setPort(REST_PORT);
    if (StringUtils.isEmpty(serverConfigInfo.getFilePath())) {
        serverConfigInfo.setFilePath(System.getProperty("user.home") + File.separator + "Downloads");
    }
    new SpringApplicationBuilder(DownRestServer.class).headless(false).build().run();
}
Also used : DownRestServer(org.pdown.rest.DownRestServer) HttpDownAppCallback(org.pdown.gui.rest.HttpDownAppCallback) SpringApplicationBuilder(org.springframework.boot.builder.SpringApplicationBuilder) ServerConfigInfo(org.pdown.rest.entity.ServerConfigInfo)

Example 80 with SpringApplicationBuilder

use of org.springframework.boot.builder.SpringApplicationBuilder in project hub-detect by blackducksoftware.

the class Application method main.

public static void main(final String[] args) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
    builder.logStartupInfo(false);
    builder.run(args);
}
Also used : SpringApplicationBuilder(org.springframework.boot.builder.SpringApplicationBuilder)

Aggregations

SpringApplicationBuilder (org.springframework.boot.builder.SpringApplicationBuilder)319 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)170 Test (org.junit.Test)156 OutputDestination (org.springframework.cloud.stream.binder.test.OutputDestination)105 InputDestination (org.springframework.cloud.stream.binder.test.InputDestination)100 Test (org.junit.jupiter.api.Test)82 ApplicationContext (org.springframework.context.ApplicationContext)55 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)26 Environment (org.springframework.cloud.config.environment.Environment)19 Before (org.junit.Before)8 SpringApplication (org.springframework.boot.SpringApplication)8 Map (java.util.Map)7 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)7 ConsulClient (com.ecwid.consul.v1.ConsulClient)6 Message (org.springframework.messaging.Message)6 MessageHeaders (org.springframework.messaging.MessageHeaders)6 GenericMessage (org.springframework.messaging.support.GenericMessage)6 ArrayList (java.util.ArrayList)5 LinkedHashMap (java.util.LinkedHashMap)5 CountDownLatch (java.util.concurrent.CountDownLatch)5