Before, a spring boot application that used PropertiesLauncher
(archived by spring boot maven plugin with ZIP layout) can load a resource via the url just like "jar:file:/var/lib/application.jar!/BOOT-INF/classes!/application.yml" returned by Application.class.getResource("/application.yml")
.
Since upgrade to spring-boot v2.3.0, it doesn't work any more, dig in code, finding is:
In Launcher.java, The spring-boot url protocol handler is registered only if is exploded, and isExploded() return true by default.
protected void launch(String[] args) throws Exception {
if (!isExploded()) {
JarFile.registerUrlProtocolHandler();
}
...
}
...
protected boolean isExploded() {
return true;
}
and PropertiesLauncher inherit Launcher without overriding isExploded(), so the application fail to load in non-exploded mode.
Is that on purpose? Does not PropertiesLauncher support non-exploded mode in v2.3.0? Or maybe similar to ExecutableArchiveLauncher, PropertiesLauncher should override isExploded() and return true or false based on archive is exploded or not.
@Override
protected boolean isExploded() {
return this.archive.isExploded();
}
Comment From: wilkinsona
@jianshaow Thanks for the report. I think this was an accidental change in behaviour. PropertiesLauncher
should still support being run from an archive (non-exploded) in 2.3.
Comment From: wilkinsona
loadResourceFromJarFile
is failing on Windows as it appears to be leaving a file open, preventing it from being deleted.
Comment From: philwebb
The Windows build is green again.