-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
HHH-18982 make BeanContainer loadable as a Java service #9656
Conversation
@sebersole in my testing, the use of reflection in |
hibernate-core/src/main/java/org/hibernate/resource/beans/spi/ManagedBeanRegistryInitiator.java
Fixed
Show fixed
Hide fixed
The pertinent javadoc is :
If CDI is not in the classpath and it stil works, then I'm confused but great |
Well I mean if the classes that import CDI types are never loaded, then CDI types aren't loaded either. |
The VM won't load classes it doesn't need. |
Depends if CDI is always on the classpath of the user code when run in a container. Wild Fly, e.g., always passes Hibernate a BeanManager reference iiuc which would trigger this code. |
But if WildFly passes a |
Sure. But the reflection was intended to give a useful waring -
Ultimately the exception will be the same ofc -
Now, we could look at simply catching the class-loading exception somewhere and logging the nice warning. |
also remove unnecessary use of reflection for creation of the CDI BeanContainer
OK, so what I did instead was do the check upfront and throw a sensible exception. If this change breaks anything we will know soon enough, and the cause of breakage will be clear. |
also remove unnecessary use of reflection for creation of the CDI
BeanContainer
[Please describe here what your change is about]
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
https://hibernate.atlassian.net/browse/HHH-18982