use of org.springframework.boot.test.context.FilteredClassLoader in project spring-boot by spring-projects.
the class AbstractApplicationContextRunnerTests method consecutiveRunWithFilteredClassLoaderShouldHaveBeanWithLazyProperties.
@Test
void consecutiveRunWithFilteredClassLoaderShouldHaveBeanWithLazyProperties() {
get().withClassLoader(new FilteredClassLoader(Gson.class)).withUserConfiguration(LazyConfig.class).run((context) -> assertThat(context).hasSingleBean(ExampleBeanWithLazyProperties.class));
get().withClassLoader(new FilteredClassLoader(Gson.class)).withUserConfiguration(LazyConfig.class).run((context) -> assertThat(context).hasSingleBean(ExampleBeanWithLazyProperties.class));
}
use of org.springframework.boot.test.context.FilteredClassLoader in project spring-boot by spring-projects.
the class XADataSourceAutoConfigurationTests method createNonEmbeddedFromXAProperties.
@Test
void createNonEmbeddedFromXAProperties() {
new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(XADataSourceAutoConfiguration.class)).withUserConfiguration(FromProperties.class).withClassLoader(new FilteredClassLoader("org.h2.Driver", "org.hsqldb.jdbcDriver")).withPropertyValues("spring.datasource.xa.data-source-class-name:com.ibm.db2.jcc.DB2XADataSource", "spring.datasource.xa.properties.user:test", "spring.datasource.xa.properties.password:secret").run((context) -> {
MockXADataSourceWrapper wrapper = context.getBean(MockXADataSourceWrapper.class);
XADataSource xaDataSource = wrapper.getXaDataSource();
assertThat(xaDataSource).isInstanceOf(DB2XADataSource.class);
});
}
use of org.springframework.boot.test.context.FilteredClassLoader in project spring-boot by spring-projects.
the class AopAutoConfigurationTests method whenGlobalMethodSecurityIsEnabledAndAspectJIsNotAvailableThenClassProxyingIsStillUsedByDefault.
@Test
void whenGlobalMethodSecurityIsEnabledAndAspectJIsNotAvailableThenClassProxyingIsStillUsedByDefault() {
this.contextRunner.withClassLoader(new FilteredClassLoader(Advice.class)).withUserConfiguration(ExampleController.class, EnableGlobalMethodSecurityConfiguration.class).run((context) -> {
ExampleController exampleController = context.getBean(ExampleController.class);
assertThat(AopUtils.isCglibProxy(exampleController)).isTrue();
});
}
use of org.springframework.boot.test.context.FilteredClassLoader in project spring-boot by spring-projects.
the class R2dbcRepositoriesAutoConfigurationTests method backsOffWithNoDatabaseClientOperations.
@Test
void backsOffWithNoDatabaseClientOperations() {
this.contextRunner.withConfiguration(AutoConfigurations.of(R2dbcAutoConfiguration.class)).withClassLoader(new FilteredClassLoader("org.springframework.r2dbc")).withUserConfiguration(TestConfiguration.class).run((context) -> {
assertThat(context).doesNotHaveBean(DatabaseClient.class);
assertThat(context).doesNotHaveBean(R2dbcRepositoryConfigurationExtension.class);
});
}
use of org.springframework.boot.test.context.FilteredClassLoader in project spring-boot by spring-projects.
the class HazelcastAutoConfigurationServerTests method autoConfiguredConfigWithoutHazelcastSpringDoesNotUseSpringManagedContext.
@Test
void autoConfiguredConfigWithoutHazelcastSpringDoesNotUseSpringManagedContext() {
this.contextRunner.withClassLoader(new FilteredClassLoader(SpringManagedContext.class)).run((context) -> {
Config config = context.getBean(HazelcastInstance.class).getConfig();
assertThat(config.getManagedContext()).isNull();
});
}
Aggregations