Grails: Dynamically inject service in domain class

Posted by rukoche on Stack Overflow See other posts from Stack Overflow or by rukoche
Published on 2010-05-11T20:18:09Z Indexed on 2010/05/11 20:24 UTC
Read the original article Hit count: 382

I need to inject a service based on domain property, so far I came up with the following:

ApplicationHolder.application.getServiceClass("package.${property}Service").clazz

but loading it this way doesn't inject it's dependent services. Am I doing it wrong?

© Stack Overflow or respective owner

Related posts about groovy

Related posts about grails