-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Description
Hello Spring Team
Currently and so far in SF 7.0
For a Test class when it uses @ActiveProfiles it works as expected by applying the profile(s) defined through the profiles element. But is not possible override this through the command by -Dspring.profiles.active=...
In other words
- Override
@ActiveProfiles({"dev","cache"})by-Dspring.profiles.active=prod,-no-cache
Of course, if the test class comments @ActiveProfiles({"dev","cache"}) then -Dspring.profiles.active=prod,-no-cache works in peace
Is there an official explicit indication and explanation about
- Why is not possible override the profiles
@ActiveProfilesthrough-Dspring.profiles.active=...? - How to accomplish the desired goal?
I already did do a research in the official documentation at:
And there is nothing about to resolve 1 and 2
According with my understanding to accomplish (2) is
a. Implement the ActiveProfilesResolver interface to take in consideration the spring.profiles.active option over the profiles element. Of course it only if the former exists, otherwise the latter works in peace (practically the current behavioir of the unique and default implementation: the DefaultActiveProfilesResolver class)
b. Finally refer this implementation through the resolver element as @ActiveProfiles(profiles={"dev","cache"}, resolver=ImprovedActiveProfilesResolver.class)
Thanks for your understanding