Eugen Paraschiv opened SPR-9338 and commented

It would be extremely useful if @ActiveProfiles were supported for both methods as well as entire classes; this would enable much more granular support for switching between profiles (without needing to create an new test class) which is useful for some specific use cases of profiles (where this kind of granularity makes perfect sense).


Affects: 3.1 GA

Issue Links: - #16647 Support @ContextConfiguration at method level - #18951 Support @TestPropertySource at method level

Comment From: spring-projects-issues

Chris Beams commented

Interesting idea. Sam, perhaps you considered this at some point? At a glance, I don't see a reason why it couldn't be supported. It would of course require creating a new ApplicationContext for any methods so annotated, but we already have precedent for that with @DirtiesContext.

Sam can weigh in about feasibility here, but as I just mentioned in #12524, this would also probably make for a good pull request if you're interested in taking a shot at it. Here's the link to the contributor guidelines again.

Comment From: spring-projects-issues

Chris Beams commented

Assigning to you Sam; see my previous comment.

Comment From: spring-projects-issues

Sam Brannen commented

This is closely related to #16647.