use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class SampleWebSocketsApplicationTests method reverseEndpoint.
@Test
void reverseEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class).properties("websocket.uri:ws://localhost:" + this.port + "/reverse").run("--spring.main.web-application-type=none");
long count = context.getBean(ClientConfiguration.class).latch.getCount();
AtomicReference<String> messagePayloadReference = context.getBean(ClientConfiguration.class).messagePayload;
context.close();
assertThat(count).isEqualTo(0);
assertThat(messagePayloadReference.get()).isEqualTo("Reversed: !dlrow olleH");
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class CustomContainerWebSocketsApplicationTests method echoEndpoint.
@Test
void echoEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class).properties("websocket.uri:ws://localhost:" + this.port + "/ws/echo/websocket").run("--spring.main.web-application-type=none");
long count = context.getBean(ClientConfiguration.class).latch.getCount();
AtomicReference<String> messagePayloadReference = context.getBean(ClientConfiguration.class).messagePayload;
context.close();
assertThat(count).isEqualTo(0);
assertThat(messagePayloadReference.get()).isEqualTo("Did you say \"Hello world!\"?");
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class CustomContainerWebSocketsApplicationTests method echoEndpoint.
@Test
void echoEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class).properties("websocket.uri:ws://localhost:" + this.port + "/ws/echo/websocket").run("--spring.main.web-application-type=none");
long count = context.getBean(ClientConfiguration.class).latch.getCount();
AtomicReference<String> messagePayloadReference = context.getBean(ClientConfiguration.class).messagePayload;
context.close();
assertThat(count).isEqualTo(0);
assertThat(messagePayloadReference.get()).isEqualTo("Did you say \"Hello world!\"?");
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project midpoint by Evolveum.
the class MidPointSpringApplication method main.
public static void main(String[] args) {
System.out.println("ClassPath: " + System.getProperty("java.class.path"));
System.setProperty("xml.catalog.className", "com.evolveum.midpoint.prism.impl.schema.CatalogImpl");
String mode = args != null && args.length > 0 ? args[0] : null;
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("PID:" + ManagementFactory.getRuntimeMXBean().getName() + " Application mode:" + mode + " context:" + applicationContext);
}
if (applicationContext != null && "stop".equals(mode)) {
System.exit(SpringApplication.exit(applicationContext, () -> 0));
} else {
applicationContext = configureApplication(new SpringApplicationBuilder()).run(args);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("PID:" + ManagementFactory.getRuntimeMXBean().getName() + " Application started context:" + applicationContext);
}
}
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project dubbo by alibaba.
the class AwaitingNonWebApplicationListenerTest method testSingleContextNonWebApplication.
@Test
public void testSingleContextNonWebApplication() {
new SpringApplicationBuilder(Object.class).web(false).run().close();
ShutdownHookCallbacks.INSTANCE.addCallback(() -> {
AtomicBoolean awaited = AwaitingNonWebApplicationListener.getAwaited();
Assert.assertTrue(awaited.get());
System.out.println("Callback...");
});
}
Aggregations