I have 2 maven submodules, in a multi-module project, raft-api and raft-core.
I have raft-core depend on raft-api.
raft-api defines below:
RaftConfig.java
RaftEngine.java (interface used by caller)
RaftEngineProvider.java (factory for creating implementation of above interface)
I want RaftEngineProvider, the factory, to provide an implementation from raft-core.
This would however lead to a cyclic dependency between 2 modules.
I would not want to create a new module where i put the interface as that would force clients to depend on 2 modules. One way to think of is to use reflection to create instance in RaftEngineProvider, just delaying the dependency to runtime but not sure it makes sense.
Are there other ways to do it better?