org.springframework.cloud.commons.util.UtilAutoConfiguration Java Examples

The following examples show how to use org.springframework.cloud.commons.util.UtilAutoConfiguration. 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: KubernetesDiscoveryClientConfigClientBootstrapConfigurationTests.java    From spring-cloud-kubernetes with Apache License 2.0 6 votes vote down vote up
private void setup(String... env) {
	AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext();
	TestPropertyValues.of(env).applyTo(parent);
	parent.register(UtilAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class, EnvironmentKnobbler.class,
			KubernetesDiscoveryClientConfigClientBootstrapConfiguration.class,
			DiscoveryClientConfigServiceBootstrapConfiguration.class,
			ConfigClientProperties.class);
	parent.refresh();
	this.context = new AnnotationConfigApplicationContext();
	this.context.setParent(parent);
	this.context.register(PropertyPlaceholderAutoConfiguration.class,
			KubernetesAutoConfiguration.class,
			KubernetesDiscoveryClientAutoConfiguration.class);
	this.context.refresh();
}
 
Example #2
Source File: DiscoveryClientConfigServiceAutoConfigurationTests.java    From spring-cloud-zookeeper with Apache License 2.0 6 votes vote down vote up
private void setup(String... env) {
	AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext();
	TestPropertyValues.of(env).applyTo(parent);
	parent.register(UtilAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class, EnvironmentKnobbler.class,
			ZookeeperDiscoveryClientConfigServiceBootstrapConfiguration.class,
			DiscoveryClientConfigServiceBootstrapConfiguration.class,
			ConfigClientProperties.class);
	parent.refresh();
	this.context = new AnnotationConfigApplicationContext();
	this.context.setParent(parent);
	this.context.register(PropertyPlaceholderAutoConfiguration.class,
			ZookeeperConfigServerAutoConfiguration.class,
			ZookeeperAutoConfiguration.class,
			ZookeeperDiscoveryClientConfiguration.class);
	this.context.refresh();
}
 
Example #3
Source File: BaseDiscoveryClientConfigServiceBootstrapConfigurationTests.java    From spring-cloud-config with Apache License 2.0 6 votes vote down vote up
void setup(boolean refresh, boolean registerDiscoveryClient, String... env) {
	this.context = new AnnotationConfigApplicationContext();
	TestPropertyValues.of(env).applyTo(this.context);
	TestPropertyValues.of("eureka.client.enabled=false").applyTo(this.context);
	if (registerDiscoveryClient) {
		this.context.getDefaultListableBeanFactory()
				.registerSingleton("discoveryClient", this.client);
	}
	this.context.register(UtilAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class,
			DiscoveryClientConfigServiceBootstrapConfiguration.class,
			ConfigServiceBootstrapConfiguration.class, ConfigClientProperties.class);
	if (refresh) {
		this.context.refresh();
	}
}
 
Example #4
Source File: EurekaClientAutoConfigurationTests.java    From spring-cloud-netflix with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientWhenBlockingDiscoveryDisabled() {
	new ApplicationContextRunner()
			.withConfiguration(AutoConfigurations.of(UtilAutoConfiguration.class,
					DiscoveryClientOptionalArgsConfiguration.class,
					EurekaClientAutoConfiguration.class,
					EurekaDiscoveryClientConfiguration.class))
			.withPropertyValues("spring.cloud.discovery.blocking.enabled=false")
			.run(context -> {
				assertThat(context).doesNotHaveBean(DiscoveryClient.class);
				assertThat(context)
						.doesNotHaveBean(DiscoveryClientHealthIndicator.class);
			});
}
 
Example #5
Source File: ConsulDiscoveryClientConfigurationTests.java    From spring-cloud-consul with Apache License 2.0 5 votes vote down vote up
private void setupContext(Class<?>... config) {
	ConfigurationPropertySources.attach(this.context.getEnvironment());
	this.context.register(UtilAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class, ConsulAutoConfiguration.class,
			ConsulDiscoveryClientConfiguration.class);
	for (Class<?> value : config) {
		this.context.register(value);
	}
	this.context.refresh();
}