ClassLoader.getResource("mypackageroot") fails against exploded module
Alan.Bateman at oracle.com
Fri Feb 3 19:30:27 UTC 2017
On 03/02/2017 18:17, Juergen Hoeller wrote:
> Spring's classpath scanning works fine on JDK 9 for classpath resources
> (archives as well directories) and also for archives on the module path.
> However, it does not work for an exploded module layout, simply
> because ClassLoader.getResource("mypackageroot") always returns null in
> such a scenario.
> Since ClassLoader.getResource("mypackageroot") works in all other
> scenarios, including module jars on the module path, I wonder whether this
> is accidental?
Sadly, resource names have always been poorly specified. It's very much
implementation and class loader specific as to whether you could get a
URL to a "directory" like this. However, you are right that there is an
inconsistency between exploded and packages modules that we should sort out.
More information about the jigsaw-dev