Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why multiple implementations not allowed declare as module service in module-info.java?

I have one module that provides two implementations of a interface. I am getting compile error 'Duplicate service entry: org.util.hsm.api.HSMService'. Both of implementations belong to same module.

module-info.java

module org.util.thales.hsm {
    uses org.util.hsm.api.HSMService;
    provides org.util.hsm.api.HSMService with org.util.hsm.thales.ThalesHSMService;
    provides org.util.hsm.api.HSMService with org.util.hsm.safenet.SafeNetHSMService;
}
like image 651
krishna Telgave Avatar asked Apr 08 '26 19:04

krishna Telgave


1 Answers

After a lot of trial and error, i found the solution.

module org.util.thales.hsm {
    uses org.util.hsm.api.HSMService;
    provides org.util.hsm.api.HSMService with org.util.hsm.thales.ThalesHSMService, org.util.hsm.safenet.SafeNetHSMService;
}
like image 183
krishna Telgave Avatar answered Apr 10 '26 21:04

krishna Telgave



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!