Open rmannibucau opened 3 years ago
I completely agree. Trying to make a magical connection between a CDI container and a jsonb provider is at best unreliable and so should not even be considered. CDI should only play a role if the the instance was provided via a bean. This is clean and free of magic (while current approach is prone to error and hard to implement.)
Today if you do:
and map a model using a cdi adapter bound with
then it works whereas it must not.
However if you would do:
it should work
The issue not respecting that is you never know when creating a jsonb instance if CDI must be used or not. When aggregating libraries and inheriting from jsonb "standalone" instances you can end up using a CDI bean and make the SE library misbehave. The other issue for implementation is to know CDI must be used or not, in some environment like OSGi it is almost impossible - leading to dropping that feature.
Therefore the proposal of this ticket is to:
Note: doing 2 in the other way is a workaround but keeps existing code broken. I understand changing 1.+2. can break code also but since it is saner and both options break some libs/apps I think it is worth make it clean now (+ it is very rarely used).