spring-attic / spring-native

Spring Native is now superseded by Spring Boot 3 official native support
https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html
Apache License 2.0
2.74k stars 356 forks source link

Factory code generator can fail if outer class cannot be loaded #1594

Closed snicoll closed 1 year ago

snicoll commented 2 years ago

As a follow-up of #1592, the current code failed because the factory implementation is a static inner class of the related class that it handles and the code generation needs to load it to determine its canonical name.

Here is an example of a factory entry we have to implement: https://github.com/spring-projects/spring-boot/blob/35efc23deb467d3d9382624d49fb6aab3333af09/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebServerApplicationContext.java#L212-L224

While the class itself is shielded from its parent, code generation can lead us to get the canonical name of it and this would as a result load the inner class.

sdeleuze commented 1 year ago

Spring Native is now superseded by Spring Boot 3 official native support, see the related reference documentation for more details.

As a consequence, I am closing this issue, and recommend trying your use case with latest Spring Boot 3 version. If you still experience the issue reported here, please open an issue directly on the related Spring project (Spring Framework, Data, Security, Boot, Cloud, etc.) with a reproducer.

Thanks for your contribution on the experimental Spring Native project, we hope you will enjoy the official native support introduced by Spring Boot 3.