I know how an empty beans.xml
can resolve the issue in case of a straightforward dependency as described here
The question is how we can achieve a similar result when the dependency between the submodules has the opposite direction. So based on the example of the linked question what if instead of this setup
// service-module build.gradle
dependencies {
implementation project(":library-module")
}
we had this one
// library-module build.gradle
dependencies {
implementation project(":service-module")
}
As a use case consider a service that follows the ports & adapters architecture,
where ports are located in the application
module and the adapters implementations are located in the adapters
module.
// application module
public interface WebPort {}
---
@ApplicationScoped
public class AppService {
@Inject
WebPort webPort;
...
}
//adapters module
// build.gradle
dependencies {
// this is in order to have the WebPort available
implementation project(":application")
}
@ApplicationScoped
public class WebAdapter implements WebPort {
...
}
Currently, this setup throws an UnsatisfiedResolutionException
as the application-module cannot see the WebAdapter
bean.
Is it possible to have a similar working setup?