Skip to content

ActiveProfilesResolver is supplied composed annotation class instead of test class [SPR-11467] #16093

Closed

Description

@spring-projects-issues

Sam Brannen opened SPR-11467 and commented

Status Quo

The Javadoc for ActiveProfilesResolver.resolve(Class) states the following:

Resolve the bean definition profiles to use when loading an ApplicationContext for the given test class.

Parameters: testClass the test class for which the profiles should be resolved; never null

This contract was honored for the initial support of ActiveProfilesResolver; however, with the added support for using test-related annotations as meta-annotations, if @ActiveProfiles is used as a meta-annotation on a custom composed annotation, then the composed annotation is passed to the resolve() method instead of the test class.


Deliverables

  1. Ensure that the actual test class is always passed to ActiveProfilesResolver.resolve(Class).

Affects: 4.0 GA

Issue Links:

Referenced from: commits 5f7d175

Activity

  1. spring-projects-issues commented on Feb 22, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Sam Brannen commented

    Fixed as described in the comments for GitHub commit 5f7d175:

    Always pass test class to ActiveProfilesResolver

    Prior to this commit, if @ActiveProfiles were used as a meta-annotation
    on a composed annotation, then the composed annotation's class would be
    passed to the ActiveProfilesResolver.resolve() method instead of the
    test class, which breaks the contract for ActiveProfilesResolver.

    This commit addresses this issue by ensuring that the actual test class
    is always passed to ActiveProfilesResolver.resolve().

  2. added
    type: bug
    in: test
    on Jan 11, 2019
  3. added this to the 4.0.3 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: testtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions