Skip to content

@Profile should be able to define profiles to accomplish the 'and' scenario [SPR-15634] #20193

Closed
@spring-projects-issues

Description

@spring-projects-issues

Manuel Jordan opened SPR-15634 and commented

The current @Profile's value attribute behaves how an OR

Thus having the following:

@Component
@JmxProfile
@FileProfile
@ManagedResource(description="Admin SimpleFileReaderLoggingWriter")
public class SimpleFileReaderLoggingWriterJmx {

or

@Component
@Profile(value={"jmx","file"})
@ManagedResource(description="Admin SimpleFileReaderLoggingWriter")
public class SimpleFileReaderLoggingWriterJmx {

It behaves: use this bean when the profile is either jmx or file (mostly for the second scenario, seems I need other approach for the first scenario, I mean, an annotation that wraps other annotations)

Seems we need a new attribute that behaves how an AND. It to represents:
use this bean when the profiles are jmx and file

Sadly it is not a @Configuration class where I am able to use the @Profile together with the @Configuration and @Bean to represent the AND scenario. But here we are in the business or model area.

Not sure if exists other approach to accomplish this.

Thank you.


Affects: 4.3 GA, 4.3.8

Reference URL: https://stackoverflow.com/questions/38133808/spring-multiple-profiles-active

Issue Links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issuetype: taskA general task

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions