Skip to content

Fat jar has two candidate URLs for classpath*:**/ patterns, leading to resources duplication #7449

Closed
@snicoll

Description

@snicoll

This is a follow-up of SPR-14934.

Assume we need to collect the resources matching the classpath*:/**/*.xml pattern in a Spring Boot application. As of 1.4, two root urls will be used for the search:

jar:file:/Users/foo/SPR-13685/target/SPR-13685-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/
jar:file:/Users/foo/SPR-13685/target/SPR-13685-0.0.1-SNAPSHOT.jar!/

The former is the one used by the LaunchedUrlClassLoader and the latter is used by the system classloader. Because we asked to search "everything", the system classloader finds the resource again, leading to a duplication. Arguably, the system classloader must ignore anything in BOOT-INF since it is managed by the LaunchedUrlClassLoader already.

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