About Question enthuware.ocpjp.ii.v11.2.3449 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
sir_Anduin@yahoo.de
Posts: 62
Joined: Fri Aug 07, 2015 2:16 pm
Contact:

About Question enthuware.ocpjp.ii.v11.2.3449 :

Post by sir_Anduin@yahoo.de »

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?

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3449 :

Post by admin »

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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 53 guests