Research Java Platform Module System (JPMS)
The diagram of the JPMS modules
Maven Module Name | JPMS Module Name | Module Descriptor Link |
---|---|---|
service | kp.service | 'module-info.java' |
service-provider | kp.provider | 'module-info.java' |
service-client | kp.client | 'module-info.java' |
Java source code. Packages:
module 'service':
kp.service
module 'service-provider':
kp.provider
module 'service-client':
kp.client
module 'service':
Java API Documentation
module 'service-provider':
Java API Documentation
module 'service-client':
Java API Documentation
Action:
1. Build and run the
'KpServiceClient' with the batch file
'01 MVN clean install + Run Application.bat'.
1. Alternative action: build and run the
'KpServiceClient' with the batch file
'02 Create Image And Run.bat'.
This process uses the local Maven repository.
It creates the run-time image with the Java linker jlink and uses the generated runtime for execution.
2. The service registering and loading.
The diagram of the service registering and loading
The two providers of the 'kp.service.KpService' implementation:
-
'kp.provider.KpServiceProviderSimple',
the providing method: 'kp.provider.KpServiceProviderSimple::provider' -
'kp.provider.KpServiceProviderComplex',
the providing method: 'kp.provider.KpServiceProviderComplex::provider'
3. The main client method:
'kp.client.KpServiceClient::main'.
With the method 'java.util.ServiceLoader::load' the service providers are located and loaded.
The service method:
'kp.service.KpService::launch'.
The screenshot of the console log.