org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration Java Examples

The following examples show how to use org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration. 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: ContextRefresherTests.java    From spring-cloud-commons with Apache License 2.0 6 votes vote down vote up
@Test
public void bootstrapPropertySourceAlwaysFirst() {
	// Use spring.cloud.bootstrap.name to switch off the defaults (which would pick up
	// a bootstrapProperties immediately
	try (ConfigurableApplicationContext context = SpringApplication.run(Empty.class,
			"--spring.main.web-application-type=none", "--debug=false",
			"--spring.main.bannerMode=OFF",
			"--spring.cloud.bootstrap.name=refresh")) {
		List<String> names = names(context.getEnvironment().getPropertySources());
		System.err.println("***** " + context.getEnvironment().getPropertySources());
		then(names).doesNotContain("bootstrapProperties");
		ContextRefresher refresher = new ContextRefresher(context, this.scope);
		TestPropertyValues.of("spring.cloud.bootstrap.sources: "
				+ "org.springframework.cloud.context.refresh.ContextRefresherTests.PropertySourceConfiguration")
				.applyTo(context.getEnvironment(), Type.MAP, "defaultProperties");
		refresher.refresh();
		names = names(context.getEnvironment().getPropertySources());
		then(names).first().isEqualTo(
				PropertySourceBootstrapConfiguration.BOOTSTRAP_PROPERTY_SOURCE_NAME
						+ "-refreshTest");
	}
}
 
Example #2
Source File: BootstrapOrderingAutoConfigurationIntegrationTests.java    From spring-cloud-commons with Apache License 2.0 5 votes vote down vote up
@Test
@Ignore // FIXME: spring boot 2.0.0
public void bootstrapPropertiesExist() {
	then(this.environment.getPropertySources().contains(
			PropertySourceBootstrapConfiguration.BOOTSTRAP_PROPERTY_SOURCE_NAME))
					.isTrue();
}
 
Example #3
Source File: BootstrapOrderingCustomPropertySourceIntegrationTests.java    From spring-cloud-commons with Apache License 2.0 5 votes vote down vote up
@Test
@Ignore // FIXME: spring boot 2.0.0
public void bootstrapPropertiesExist() {
	then(this.environment.getPropertySources().contains(
			PropertySourceBootstrapConfiguration.BOOTSTRAP_PROPERTY_SOURCE_NAME))
					.isTrue();
}
 
Example #4
Source File: ConfigServerBootstrapConfigurationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@Test
public void withHealthIndicator() {
	ConfigurableApplicationContext context = new SpringApplicationBuilder(
			PropertySourceBootstrapConfiguration.class,
			ConfigServiceBootstrapConfiguration.class)
					.child(ConfigClientAutoConfiguration.class)
					.web(WebApplicationType.NONE).run();
	assertThat(BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context,
			ConfigClientProperties.class).length).isEqualTo(1);
	assertThat(BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context,
			ConfigServerHealthIndicator.class).length).isEqualTo(1);
	context.close();
}