I have a question regardning the META-INF/services file
does a service module have to declare it?
And how to I enforce that a service is present on the module? I mean that (my Main module==Service consumer) can access at least one Implementation of the service?
About Question enthuware.ocpjp.ii.v11.2.3449 :
Moderator: admin
-
- Posts: 62
- Joined: Fri Aug 07, 2015 2:16 pm
- Contact:
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3449 :
1. META-INF/services file is not required when you deploy a service as a module. In this case, only the provides clause in module-info is required.
META-INF/services is used for a regular , non-modular application, in which a service is loaded from classpath. (Ref. https://docs.oracle.com/en/java/javase/ ... oader.html )
2. There is no way to ensure that. Indeed, the whole point is that the service implementation should not be required for successful compilation of a service user. At run time, if the module system doesn't find any service implementation for a particular service, the application will not run.
META-INF/services is used for a regular , non-modular application, in which a service is loaded from classpath. (Ref. https://docs.oracle.com/en/java/javase/ ... oader.html )
2. There is no way to ensure that. Indeed, the whole point is that the service implementation should not be required for successful compilation of a service user. At run time, if the module system doesn't find any service implementation for a particular service, the application will not run.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 53 guests