use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project jersey by jersey.
the class SpringDevProfileResourceTest method configure.
@Override
protected Application configure() {
System.setProperty("spring.profiles.active", "dev");
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext("org.glassfish.jersey.server.spring.profiles");
return new ResourceConfig().register(RequestContextFilter.class).register(LoggingFeature.class).packages("org.glassfish.jersey.server.spring.profiles").property("contextConfig", context);
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project jersey by jersey.
the class SpringProfilesTest method shouldGetDevProfileBean.
@Test
public void shouldGetDevProfileBean() {
System.setProperty("spring.profiles.active", "dev");
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext("org.glassfish.jersey.server.spring.profiles");
assertEquals("dev", context.getBean(TestService.class).test());
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project zipkin by openzipkin.
the class ZipkinElasticsearchAwsStorageAutoConfigurationTest method providesAWSSignatureVersion4_whenStorageTypeElasticsearchAndDomain.
@Test
public void providesAWSSignatureVersion4_whenStorageTypeElasticsearchAndDomain() {
context = new AnnotationConfigApplicationContext();
addEnvironment(context, "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.aws.domain:foobar", "zipkin.storage.elasticsearch.aws.region:us-west-2");
context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchOkHttpAutoConfiguration.class, ZipkinElasticsearchAwsStorageAutoConfiguration.class);
context.refresh();
assertThat(context.getBean(OkHttpClient.class).networkInterceptors()).extracting(i -> i.getClass()).contains((Class) AWSSignatureVersion4.class);
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project zipkin by openzipkin.
the class ZipkinElasticsearchAwsStorageAutoConfigurationTest method doesntProvideAWSSignatureVersion4_whenStorageTypeElasticsearchAndHostsNotAwsUrls.
@Test
public void doesntProvideAWSSignatureVersion4_whenStorageTypeElasticsearchAndHostsNotAwsUrls() {
context = new AnnotationConfigApplicationContext();
addEnvironment(context, "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.hosts:https://localhost:9200");
context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchAwsStorageAutoConfiguration.class);
context.refresh();
thrown.expect(NoSuchBeanDefinitionException.class);
context.getBean(AWSSignatureVersion4.class);
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project zipkin by openzipkin.
the class ZipkinElasticsearchAwsStorageAutoConfigurationTest method doesntProvidesAWSSignatureVersion4_whenStorageTypeElasticsearchAndHostsNotUrls.
@Test
public void doesntProvidesAWSSignatureVersion4_whenStorageTypeElasticsearchAndHostsNotUrls() {
context = new AnnotationConfigApplicationContext();
addEnvironment(context, "zipkin.storage.type:elasticsearch");
context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchAwsStorageAutoConfiguration.class);
context.refresh();
thrown.expect(NoSuchBeanDefinitionException.class);
context.getBean(AWSSignatureVersion4.class);
}
Aggregations