Bruce Brouwer opened SPR-11750 and commented
It would be nice to have a generic condition that enables beans based upon the result of a SpEL expression. This is similar to #16007, but rather than activating a whole profile, this would activate individual beans. I would like to be able to do something like this (I'm not particularly keen on the names I picked):
@EnabledWhen("#{ systemProperties['a'] }")
public MyBean myBean() {
return new MyBean();
}
Issue Links: - #17835 Adding ConditionalOnProperty to spring-core
Comment From: spring-projects-issues
Stéphane Nicoll commented
Such feature already exists in boot, check org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
Comment From: spring-projects-issues
Bruce Brouwer commented
It seems like such a generally useful feature that it would be nice to have it in spring-context
Comment From: spring-projects-issues
Bruce Brouwer commented
I've pretty much switched over to Spring Boot, so feel free to close this issue.