Skip to content

PropertiesLauncher cannot load a resource in jar via URL #21575

@jianshaow

Description

@jianshaow

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();
	}

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions