Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Document semantics and behavior of SpringExtension.getApplicationContext() #35764

Copy link
Copy link
@snicoll

Description

@snicoll
Issue body actions

SpringExtension#getApplicationContext is public API available to anyone building integration with a test that uses SpringExtension. There are certain callbacks that happen early and we should not use that method as it will load the context too soon.

I think the Javadoc of this method deserves a warning. First of all, it's not obvious it'll load the context if necessary (vs. the method being merely a way to retrieve the ApplicationContext from the ExtensionContext).

I've been told ParameterResolver#supportParameter is one of those callbacks where we can't use the context. Looking at the Javadoc of ParameterResolver there is a way to figure that out as long as you understand how SpringExtension works and when it should ideally load the context. Linking that information in the Javadoc of SpringApplication#getApplicationContext would be worthwhile as well.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.