Yes, I see a lot of places using
if (loadProviderFromProperty())
return provider;
if (loadProviderAsService())
return provider;
The 1st using Class.forName() and 2nd ServiceLoader.load().
I was thinking that the 1st method will not work because Class.forName() on an
internal class in another module will not work after module, but now I believe
the 2nd method would not work also. Is that right? Or writing the class name in
a services file automatically exports it as a service?
Now my preferred order will be
if (loadProviderFromProperty())
return provider;
if (loadProviderAsInstalledService())
return provider;
if (loadProviderAsService())
return provider;
Thanks
Max
On Aug 13, 2014, at 22:20, Alan Bateman <[email protected]> wrote:
>
> ServiceLoader does not have a way to configure a preferred provider so this
> is one reason why you'll see places where a system property can be used to
> configured the preferred implementation.
>
> -Alan.