Closed
Description
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 anddependency.jar!/my/app
as value is added torootDirCache
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.