-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
missing reflection data for CGLIB$SET_THREAD_CALLBACKS
in configuration properties class
#32645
Comments
CGLIB$SET_THREAD_CALLBACKS
in configuration properties class
Thanks for the report. There's quite a lot going on in the demo application. There are many classes that I don't think are related to the problem. Kotlin is also involved which makes things quite a bit more complicated, particularly when using GraalVM. Can you please reduce the classes involved to the bare minimum required to reproduce the problem and, unless the problem only occurs with Kotlin, please write those classes in Java. |
I minified the example in the repository. Please check again. I now identified the main problem. It is not related to kotlin. The main problem seems to be the |
I also tried refactoring my code to use Any other way I could ditch the |
Thanks very much for minimising the sample. Using The use of @Bean
static MqttSubscriberCollector mqttSubscriverCollectior(@Lazy MqttProperties properties) {
return new MqttSubscriberCollector(properties);
} My goal was to make the use of We'll transfer this to the Framework team so that they can investigate. |
Yeah I got it working with |
Thanks for the report, I believe this is a duplicate of #30985 and we'll validate this sample when we get to it. |
I included a third party spring boot starter. That starter includes a configuration properties class. This class is a kotlin data class and employs Hibernate validator for some validation logic.
Not quite sure why that is though, but this class gets stubbed on runtime by a Spring cglib proxy. I suspect it's due to the validation logic. When now building a native image, this cglib proxy seems to not get register with native image. The following error is generated when trying to run the native executable:
When duplicating the configuration properties class in the main source set of the application the error does not happen and the native image generated works out of the box without any additional configuration. I also tried adding reflect config via , which did not solve the
@RegisterReflectionForBinding(MqttProperties::class)
problem though.When adding the following
reflect-config.json
the error is gone:I feel like that I as a developer should not be responsible for generating implementation detail code like reflection hints for cglib reflections. I think the code should work without any modifications out of the box.
I prepared a demo application which show cases the problem when generating it with
./gradlew nativeCompile
and then running the native binary.Is there something I'm missing here? Whats the suggested approach for a library owner which wants to support native-image for a custom spring starter?
Unsure, but maybe related to #29873?
The text was updated successfully, but these errors were encountered: