org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BinderFactoryAutoConfigurationTests.java    From spring-cloud-stream with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("rawtypes")
@Test
public void loadBinderTypeRegistryWithSharedEnvironmentAndServletWebApplicationType()
	throws Exception {
	String[] properties = new String[] {"binder1.name=foo", "spring.main.web-application-type=SERVLET"};
	ClassLoader classLoader = createClassLoader(new String[] { "binder1" },
		properties);
	ConfigurableApplicationContext context = new SpringApplicationBuilder(SimpleApplication.class, ServletWebServerFactoryAutoConfiguration.class)
		.resourceLoader(new DefaultResourceLoader(classLoader))
		.properties(properties).web(WebApplicationType.SERVLET).run();

	BinderFactory binderFactory = context.getBean(BinderFactory.class);

	Binder binder1 = binderFactory.getBinder("binder1", MessageChannel.class);
	assertThat(binder1).hasFieldOrPropertyWithValue("name", "foo");
}
 
Example #2
Source File: EnvironmentMonitorAutoConfigurationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@Test
public void testExtractorsCount() {
	ConfigurableApplicationContext context = new SpringApplicationBuilder(
			BusConfig.class, EnvironmentMonitorAutoConfiguration.class,
			ServletWebServerFactoryAutoConfiguration.class, ServerProperties.class,
			PropertyPlaceholderAutoConfiguration.class).properties("server.port=-1")
					.run();
	PropertyPathEndpoint endpoint = context.getBean(PropertyPathEndpoint.class);
	assertThat(((Collection<?>) ReflectionTestUtils.getField(
			ReflectionTestUtils.getField(endpoint, "extractor"), "extractors"))
					.size()).isEqualTo(7);
	context.close();
}
 
Example #3
Source File: EnvironmentMonitorAutoConfigurationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@Test
public void testCanAddCustomPropertyPathNotificationExtractor() {
	ConfigurableApplicationContext context = new SpringApplicationBuilder(
			BusConfig.class, CustomPropertyPathNotificationExtractorConfig.class,
			EnvironmentMonitorAutoConfiguration.class,
			ServletWebServerFactoryAutoConfiguration.class, ServerProperties.class,
			PropertyPlaceholderAutoConfiguration.class).properties("server.port=-1")
					.run();
	PropertyPathEndpoint endpoint = context.getBean(PropertyPathEndpoint.class);
	assertThat(((Collection<?>) ReflectionTestUtils.getField(
			ReflectionTestUtils.getField(endpoint, "extractor"), "extractors"))
					.size()).isEqualTo(8);
	context.close();
}