Skip to content

Provide a consistent way to discover the primary DispatcherServlet's path #13834

@snicoll

Description

@snicoll

We've introduced a DispatcherServletPathProvider in 2.x to resolve the effective servlet path of the application. We've also recently updated it to support the case of an application with multiple DispatcherServlet instances (#13603).

We're not using that information consistently: StaticResourceRequest and Error pages registration rely on on the path in properties and their usage is unknown if there are several dispatcher servlets.

I don't really know if we need to bring back a concept of "main" DispatcherServlet but it feels to me that it would be useful that one is flagged as the one where auto-configuration can apply. We could have a default getAdditionalServletPaths that returns an empty set and that users could implement for their use cases.

The lifecycle of DispatcherServletPathProvider is also a bit weird (see this getBean call).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions