Fix BOOT-INF/classes/ prefix for two-arg openClasspathResource#18292
Merged
trask merged 4 commits intoApr 29, 2026
Merged
Conversation
When the spring-boot-resources javaagent runs inside a Spring Boot fat jar, SystemHelper detects BOOT-INF/classes/ on the classpath and prepends it to single-arg openClasspathResource lookups. The two-arg overload (used by SpringBootServiceVersionDetector to read META-INF/build-info.properties) was missing the same prefix logic, so service version was not detected for fat-jar deployments.
83bfb2c to
5a2a6e1
Compare
trask
commented
Apr 26, 2026
Comment on lines
+47
to
+50
| String path = | ||
| addBootInfPrefix | ||
| ? "BOOT-INF/classes/" + directory + "/" + filename | ||
| : directory + "/" + filename; |
Member
Author
There was a problem hiding this comment.
The prefix is added under addBootInfPrefix in the single arg overload above, was just missing here. Didn't find an easy way to add a test for this.
Contributor
There was a problem hiding this comment.
The only place where this method is used is in
META-INF/build-info.properties which is at the root of the jar not under BOOT-INF/classesAdd
springBoot {
buildInfo()
}
to generate it.
…es-bootinf-version-fix # Conflicts: # instrumentation/spring/spring-boot-resources/javaagent/src/test/java/io/opentelemetry/instrumentation/spring/resources/SpringBootServiceVersionDetectorTest.java
laurit
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extracted out of #18269