Skip to content

JUnit annotations may prevent a test context from being cached #28563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ledoyen
Copy link
Contributor

@ledoyen ledoyen commented Nov 8, 2021

Hello spring-team 👋

As JUnit Jupiter comes with many new features through annotations (such as @TestInstance or @Order), it makes sens that they be ignored by the key created by ImportsContextCustomizer.

This is a small patch, but one can wonder if the key should not consider only org.springframework.* annotations or supply an extension point for custom user-defined annotations to be ignored when creating the context caching key (part).

Let me know if you need more contexts.

Best regards !

@philwebb
Copy link
Member

philwebb commented Nov 8, 2021

I think it makes sense to ignore org.junit imports. We already do the same for Spock. Unfortunately I don't think we can just limit ourselves to org.springframework.* since users might have their own annotations. I do think an extension point is a good idea. I've raised #28564 for that.

@philwebb philwebb added for: team-attention An issue we'd like other members of the team to review type: bug A general bug and removed for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged labels Nov 8, 2021
@philwebb philwebb added this to the 2.4.x milestone Nov 8, 2021
@philwebb philwebb self-assigned this Nov 8, 2021
philwebb pushed a commit that referenced this pull request Nov 8, 2021
Update `ImportsContextCustomizer` to ignore JUnit annotations.

See gh-28563
@philwebb philwebb closed this in db0287c Nov 8, 2021
@philwebb philwebb modified the milestones: 2.4.x, 2.4.13 Nov 8, 2021
@ledoyen ledoyen deleted the ignore_junit_annotations_when_caching_test_contexts branch November 9, 2021 08:10
@wilkinsona wilkinsona changed the title Ignore JUnit annotations when caching test contexts JUnit annotations may prevent a test context from being cached Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants