ConditionalOnEnabledResourceChainTests Class — spring-boot Architecture
Architecture documentation for the ConditionalOnEnabledResourceChainTests class in ConditionalOnEnabledResourceChainTests.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ConditionalOnEnabledResourceChainTests.java lines 34–90
class ConditionalOnEnabledResourceChainTests {
private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
@AfterEach
void closeContext() {
this.context.close();
}
@Test
void disabledByDefault() {
load();
assertThat(this.context.containsBean("foo")).isFalse();
}
@Test
void disabledExplicitly() {
load("spring.web.resources.chain.enabled:false");
assertThat(this.context.containsBean("foo")).isFalse();
}
@Test
void enabledViaMainEnabledFlag() {
load("spring.web.resources.chain.enabled:true");
assertThat(this.context.containsBean("foo")).isTrue();
}
@Test
void enabledViaFixedStrategyFlag() {
load("spring.web.resources.chain.strategy.fixed.enabled:true");
assertThat(this.context.containsBean("foo")).isTrue();
}
@Test
void enabledViaContentStrategyFlag() {
load("spring.web.resources.chain.strategy.content.enabled:true");
assertThat(this.context.containsBean("foo")).isTrue();
}
private void load(String... environment) {
this.context.register(Config.class);
TestPropertyValues.of(environment).applyTo(this.context);
this.context.refresh();
}
@Configuration(proxyBeanMethods = false)
static class Config {
@Bean
@ConditionalOnEnabledResourceChain
String foo() {
return "foo";
}
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free