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

Stereotype @Profiles not merged [SPR-10812] #15438

Closed
spring-projects-issues opened this issue Aug 7, 2013 · 2 comments
Closed

Stereotype @Profiles not merged [SPR-10812] #15438

spring-projects-issues opened this issue Aug 7, 2013 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Aug 7, 2013

Emerson Farrugia opened SPR-10812 and commented

I created environment stereotype annotations @Production, @Staging, and @Development to easily control which environment a few beans are available in. These annotations in turn have @Profile("somestring") as a meta-annotation.

I've hit an issue where the same @Component might be available in multiple environments, but not all of them, e.g.

@Staging
@Production
@Service
public class SomeService { ...

The org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider only sees one of the @Profile meta-annotations, and I don't see an obvious pattern as to which it's picking.

Is it possible to compute the disjunction of all available profiles in this case? Profile negation might be fun.


Affects: 3.2.3

Issue Links:

Referenced from: commits aecf60d

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Indeed, at this point, we only expect one @Profile annotation or one custom annotation meta-annotated with @Profile... In case of multiple occurences of the latter, the behavior is essentially undefined.

We have a few related considerations for 4.0 anyway, so I'll put this onto the list for 4.0 RC1 still.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Jakub Kubrynski commented

@juergen.hoeller Maybe this functionality could be controlled by @Profile attribute on last class in hierarchy? Like

@Profile("schedule", mergeInheritedProfiles = true)

That will allow us to inherit profiles from custom stereotypes.

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) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants