Skip to content

VersionResourceResolver's versionStrategyMap should keep insertion order [SPR-13798] #18371

Closed
@spring-projects-issues

Description

@spring-projects-issues

Felix Kurth opened SPR-13798 and commented

Within the class

org.springframework.web.servlet.resource.VersionResourceResolver

The property

private final Map<String, VersionStrategy> versionStrategyMap = new HashMap<String, VersionStrategy>();

should be a LinkedHashMap
otherwise the resolver order maybe wrong if multiple version strategies are in use. The ant matchers are applied in wrong order.

<mvc:resource-chain resource-cache="false"  >
        <mvc:resolvers >
            <mvc:version-resolver >
                <mvc:fixed-version-strategy patterns="/images/*.png" version="1" />
                <mvc:fixed-version-strategy patterns="./**" version="1" />
                <mvc:fixed-version-strategy patterns="/**" version="3" />
            </mvc:version-resolver>
        </mvc:resolvers>
    </mvc:resource-chain>

Affects: 4.1.8, 4.2.3

Referenced from: commits 3be35c0, 46016d0

Backported to: 4.1.9

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