In ruby modules are used either as mixins or to namespace a class (e.g. Net::HTTP
).
To mixin the behavior you can use @mixin annotation. like examples here http://groovy.codehaus.org/Category+and+Mixin+transformations.
To namespace, groovy uses same mechanism as java i.e. using packages (e.g. groovy.sql.Sql
).
I am not sure if that answered your question or not. But for dependency injection, while its common to do it mixin way in ruby (or even in scala/play), I have not seen it done a lot using @mixin
in groovy. Usually a DI container like spring is used.