-
Notifications
You must be signed in to change notification settings - Fork 3k
Use SyntheticBeanBuildItem to construct HibernateValidatorFactory #47947
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
Conversation
This comment has been minimized.
This comment has been minimized.
It seems like this change has caused more types to be reachable and tripping GraalVM, so it needs more work. |
I can continue adding the necessary GraalVM configurations, but I am pretty sure I am missing how things currently work in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, so the problem is that with the new code, the ValidatorFactory
is initialized at runtime and not at static init.
And things work atm because the VF is initialized at static init.
That definitely makes sense, but the way the Synthetic Bean is created, it should be static-init and not runtime init. |
I added some debug statements and the |
@mkouba what is the expectation here for synthetic beans that are |
The recorder is called during |
The recorder yes, but how about the function itself (the one returned by the recorder)? |
When the relevant bean is created. When exactly? That depends on the scope and the "clients" (e.g. other CDI beans that invoke methods of the bean). |
I see, that makes sense. Assuming the bean is |
Like an equivalent of |
Yes, there's |
Yes but my understanding of At least my attempt to use it didn't change at thing. |
@geoand FYI, I pushed an additional commit with some further cleanup that should be squashed once we figure out how to do things properly. I dropped the additional GraalVM stuff as it's not the way to go. |
👍🏽 I'm also trying something to fix native. |
Okay, fixed it |
Ah, yes you're right. I misread your comment. Normal beans can observe the |
I pushed a commit that should also be squashed if we agree it's the way to go. |
// this is done in order to ensure that HibernateValidatorFactory is fully initialized at static init | ||
// so completely in heap and ready to go when a native image is built | ||
public void hibernateValidatorFactoryInit(BeanContainer beanContainer) { | ||
HibernateValidatorFactory hibernateValidatorFactory = beanContainer.beanInstance(HibernateValidatorFactory.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this only works because HibernateValidatorFactory
is @Singleton
and not a normal scoped bean with a client proxy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I'm aware. If it were ApplicationScoped I would have called toString
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you end up with a green CI, I think it's good to merge.
Fixes: quarkusio#47945 Co-authored-by: Guillaume Smet <[email protected]>
CI was green on my fork so I squashed, rebased and my the PR ready for review |
Status for workflow
|
AbstractMethodValidationInterceptor.validateMethodInvocation
#47945