-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Config generated classes are not registered for reflection #22474
Comments
You added a link to a Zulip discussion, please make sure the description of the issue is comprehensive and doesn't require accessing Zulip.
|
to reproduce:
application.properties:
Build and start in native mode, and invoke the hello endpoint (works in jvm mode):
|
Sounds reasonable. I'll add a better way to do this. |
let me know if I can help. |
Thanks, no worries. It is a fairly easy change. |
Description
In
ConfigMapping
we define interfaces such ascom.acme.config.MyConfig
. At build time this generates implementation classes such ascom.acme.config.MyConfig-<hash>Impl
If you intend to use those classes through reflection, you end up having to figure out the hash that has been generated, and add
@RegisterForReflection(classNames= {
com.acme.config.MyConfig-1234Impl})
into your application.In our project, we are adding the config objects into freemarker template models, and access some of the config properties from within the templates, hence the need for reflection.
Ideally those config implementation classes should be enabled for reflection, or at least (if we believe the need is rare, and/or if we fear the impact on the native exec) the application should be offered an easy way to enable those classes for reflection.
see zulip conversation
/cc @radcortez
Implementation ideas
One option would be to allow adding
@RegisterForReflection
on the config interfaces, which would be interpreted as: a registration on the config impl classes need to be done.Another option would be to add a build time parameter
register-config-classes-for-reflection/serialization
.The text was updated successfully, but these errors were encountered: