This example demonstrates how to use GDI with Ratpack to create a really lightweight, flexible, awesome webservice in Groovy with powerful dependency injection.
- Services are injected into the
com.danveloper.gdi.examples.application.ServiceContainer
class using the staticinjected
keyword (see GDI for more details). - In the
app.groovy
script for Ratpack, a new instance ofServiceContainer
is created to access the application's services. - This example demonstrates how to inject, and gain access to, a simple APIService from the Ratpack script's context.
By me
, Daniel Woods. Free-for-all. Contact me with any help or suggestions. g(daniel.p.woods@gmail.com) && t(@danveloper)