Spring Boot version: 3.4.1 Spring Core version: 6.2.1

I am getting FileNotFoundException: JAR entry my/app/config/ not found in my-app.jar!/BOOT-INF/lib/dependency.jar when using @ComponentScan and @ConfigurationPropertiesScan annotations and having a dependency.jar that contains common parent package that matches ConfigurationPropertiesScan.basePackages value.

This exception is thrown when PathMatchingResourcePatternResolver takes resources from rootDirCache that match common parent directory, updates the resource path and tries to access a directory that does not exist in that jar file.

I have a dependency.jar in my application that contains my.app package and the Application class configured like below.

@SpringBootApplication
@ConfigurationPropertiesScan("my.app.config")
@ComponentScan(basePackages = ["my.app"])
class Application
fun main(args: Array<String>) {
    @Suppress("SpreadOperator")
    runApplication<Application>(*args)
}

In this case, * An entry with my.app as key and dependency.jar!/my/app as value is added to rootDirCache while processing the @ComponentScan annotation * The same entry is read while processing ConfigurationPropertiesScan annotation as patent package matches * The File not found exception is thrown when it tries to access dependency.jar!/my/app/config which does not present in that jar file.

Comment From: snicoll

Duplicate of https://github.com/spring-projects/spring-framework/issues/34111

@bajibalu if you want to make sure your use case is tested as you experience it, you can attach a sample to that issue. Not code in text, but something we can actually run.

Comment From: bajibalu

@snicoll I will take care of testing my use case. Thanks

Comment From: snicoll

That's not what I mean. If you share a sample, we can use it before the actual release. If you test after the release and it doesn't work, you'll have to wait again.

Comment From: jhoeller

This turned out to be related but not quite a duplicate, so I'll individually schedule this for 6.2.2 (also for potential follow-ups).

Comment From: jhoeller

@bajibalu this is available in the latest 6.2.2 snapshot now, please give it an early try if you have the chance (before 6.2.2 becomes generally available on Thursday).

Comment From: bajibalu

@jhoeller and @snicoll I tested the fix with spring-core 6.2.2-SNAPSHOT. I no longer see the FileNotFoundException. The app started successfully. Thank you.

Comment From: jhoeller

Good to hear! Thanks for the immediate feedback, @bajibalu.