Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @Bean condition based on a SpEL condition [SPR-11750] #16372

Closed
spring-projects-issues opened this issue May 1, 2014 · 3 comments
Closed
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented May 1, 2014

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:

@spring-projects-issues
Copy link
Collaborator Author

Stéphane Nicoll commented

Such feature already exists in boot, check org.springframework.boot.autoconfigure.condition.ConditionalOnExpression

@spring-projects-issues
Copy link
Collaborator Author

Bruce Brouwer commented

It seems like such a generally useful feature that it would be nice to have it in spring-context

@spring-projects-issues
Copy link
Collaborator Author

Bruce Brouwer commented

I've pretty much switched over to Spring Boot, so feel free to close this issue.

@spring-projects-issues spring-projects-issues added the type: enhancement A general enhancement label Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.x Backlog milestone Jan 11, 2019
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Jul 26, 2021
@jhoeller jhoeller modified the milestones: 6.x Backlog, General Backlog Dec 23, 2023
@jhoeller jhoeller closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2023
@jhoeller jhoeller removed this from the General Backlog milestone Dec 29, 2023
@sbrannen sbrannen added the status: declined A suggestion or change that we don't feel we should currently apply label Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants