I want to exclude bean from autowiring candidates if current profile is NOT one of array, like this:
@Component
@ActiveProfiles(value = {"!profile_1", "!profile_2"})
public class MyComponentImpl implements MyComponent
@Component
public class MyComponentDummy implements MyComponent
But when i'm trying to do it via @ActiveProfiles annotation that bean doesn't seem to be excluded and i'm getting expected single matching bean but found 2
.
Am i missing something or it is impossible that way and must be done with something like
@ActiveProfiles(value = {"profile_3", "!profile_4", ... })
My spring version is 4.2.2