小编kri*_*a T的帖子

为什么多个实现不允许在 module-info.java 中声明为模块服务?

我有一个模块提供接口的两种实现。我收到编译错误“重复的服务条目:org.util.hsm.api.HSMService”。两种实现都属于同一模块。

模块信息.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;
}
Run Code Online (Sandbox Code Playgroud)

java service dependency-injection module

3
推荐指数
1
解决办法
527
查看次数

标签 统计

dependency-injection ×1

java ×1

module ×1

service ×1