I have a spring boot 3 project ,when it is run locally it is able to read file which is present on classpath. However, when native image of same app is created then it throws FileNotFoundException.

Comment From: scottfrederick

GraalVM won't load resources into a native image automatically (see https://www.graalvm.org/22.1/reference-manual/native-image/Resources/). Any resources you want included in the native image must be made known to the native-image tool when the native image is built. Spring Boot will create hints for some resources that it knows about (see https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHints.java for an example). If your app has resources in other places, you'll need to provide similar hints yourself.

If you think your resources should be registered automatically by a Spring Boot hint, please provide a complete minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it and attaching it to this issue.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.