8.2.2 Service Configuration DSL - Reference Documentation
Authors: Andres Almiray
Version: 1.2.0
8.2.2 Service Configuration DSL
Services may have some of its properties defined in external configuration files, for example inConfig.groovy
, using a simple DSL. Take for example the following service classclass NetworkService { String host int port private Server server void connect() { if (!server) { server = new Server(host, port) } } }
host
and port
) but does not define any values for them. Inside Config.groovy
we find the following definitionsservices { network { host = 'http://acme.com' port = 1234 } }
- The entry point is the top
services
section. - Each child node identifies the target service by name. Notice that the
Service
suffix is omitted. - Each property within a service block will be set on the service instance.