Skip to content

Reconsider default static locations in ResourceProperties #9240

@bclozel

Description

@bclozel

As seen in #8485, spring.resources.static-locations lists classpath and servlet locations as default values. This was causing the leaking of the whole classpath as static resources.

This has been fixed by overriding the ResourceLoader.getResourceByPath(String path) method in the reactive application context, a similar approach taken in #7880.

We can see a reactive web application as an application with no ServletContext and still keep this fix in place. In that case, "/" is still listed in the default values for static locations, and we're keeping the concept of Servlet resources in the context of non-servlet based applications.

On the other hand, we could revisit the ResourceProperties keys and separate those values in different keys, like spring.resources.static-locations and spring.resources.servlet-locations. We would still have to combine both locations lists when configuring Servlet-based applications.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions