Skip to content

AbstractFileResolvingResource.exists incorrectly reports result for resources inside of spring-boot executable jar #34796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
betalb opened this issue Apr 22, 2025 · 5 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression
Milestone

Comments

@betalb
Copy link

betalb commented Apr 22, 2025

Starting from spring-core 6.2.5 AbstractFileResolvingResource.exists will return true for non existing resources within spring boot executable jar. Earlier versions reported correct value.

This seems to be a regression, introduced as a fix of #34607.

For us, it is causing problems with ReloadableResourceBundleMessageSource, which takes base names + locale and tries to load base properties file + 2 versions of locale aware files. In our case only base properties file exists and 2 others fail to load. ReloadableResourceBundleMessageSource relies on exists check to filter out non existing resources before trying to open stream and read them. But in spring 6.2.5 non existing resources are not filtered and it tries to load them, causing warning to be logged. Those messages spam a lot in logs.

Attaching example app with reproduction jar-loader.zip. Root pom file contains property spring-core.version which can be used to switch between 6.2.4 and 6.2.5

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 22, 2025
@jhoeller jhoeller added type: regression A bug that is also a regression in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 22, 2025
@jhoeller jhoeller self-assigned this Apr 22, 2025
@jhoeller jhoeller added this to the 6.2.7 milestone Apr 22, 2025
@jhoeller
Copy link
Contributor

#34764 is probably also a consequence of the same AbstractFileResolvingResource.exists revision, even if the actual fix happened in PathMatchingResourcePatternResolver there. So it looks like we need to revise AbstractFileResolvingResource.exists itself as well.

@jhoeller
Copy link
Contributor

A fix for this (which makes your repro project log the correct existence flags) is available in the latest 6.2.7 snapshot now. Please give it an early try in your actual scenario as well...

@jhoeller
Copy link
Contributor

A revised check for this is coming to the next 6.2.7 snapshot, improving the consistency between jar root checks and jar entry checks.

@betalb
Copy link
Author

betalb commented Apr 23, 2025

I've checked, using snapshot version spring-core-6.2.7-20250423.083751-6.jar and it works as expected, thank you.

@jhoeller
Copy link
Contributor

Good to hear! Thanks for the immediate feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

3 participants