[hibernate-dev] Usage of the Service pattern in Hibernate Search
Sanne Grinovero
sanne at hibernate.org
Thu Mar 19 21:13:58 EDT 2015
Looks like the ServiceRegistry pattern is getting quite popular in
Hibernate Search.
There are three default implementations (of three services) which are
provided by the hibernate-search-engine itself.
Essentially the hibernate-search-engine code looks it up, and loads
from its very same jar; I'm finding this a bit weird.
Wouldn't it make more sense to actually look up for the service only
for alternative (non-default) implementations?
We don't have a strategy to pick one implementation if there are
multiple implementations around (other than throwing an exception), so
having a service defined in the engine jar, essentially means noone
can plug an alternative, unless he overrides the
SearchConfiguration#getProvidedServices() method.
So if the intention was to allow choice, something is missing. If not,
I'd rather load the default implementations explicitly (via their
traditional constructor).
More information about the hibernate-dev
mailing list