Skip to content

ResourceUrlProvider detects wrong set of handler mappings #26561

Closed
@bclozel

Description

@bclozel

See spring-projects/spring-boot#25113 for more context.

ResourceUrlProvider is listening on ContextRefreshedEvent to detect automatically instances of SimpleUrlHandlerMapping and use them for writing URLs to resources. Once handlers are detected the provider locks itself from further modifications.

With a parent/child context setup and under specific conditions due to ordering, the ResourceUrlProvider might receive a ContextRefreshedEvent from a child context first, thus detecting the wrong set of handlers and ignoring the expected ContextRefreshedEvent once all components are ready in the current context.

We must ensure that ResourceUrlProvider only considers events sent by the current context - this is a common pattern in other parts of Spring Framework.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions