Skip to content

Instantly share code, notes, and snippets.

@DNAlchemist
Created June 28, 2018 11:15
Show Gist options
  • Save DNAlchemist/19472ab2e08caca800df8d42b5afb887 to your computer and use it in GitHub Desktop.
Save DNAlchemist/19472ab2e08caca800df8d42b5afb887 to your computer and use it in GitHub Desktop.
import org.springframework.beans.factory.annotation.Autowired
import ratpack.handling.Chain
import ratpack.http.client.HttpClient
// project 1
// no dependencies
interface Service {
void doRequest()
}
// project 2
// depends on ratpack, project 1
class Handler {
// ServiceImpl instance
@Autowired
Service service
def execute(Chain chain) {
chain.path('doRequest') { ctx ->
HttpClient httpClient = ctx.get(HttpClient)
service.doRequest()
}
}
}
// project 3
// depends on ratpack, project 1, project 2
class ServiceImpl implements Service {
void doRequest() {
// need HttpClient
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment