Connect to Grails Datasource from Grails Plugin Command -


i'm attempting write plugin grails automatically generate domain classes based on special views we're designing in our legacy database. want save myself time manually writing mapping stuff required make domain classes work.

do have access datasource defined in application.yml of project custom applicationcommand implementation? if so, how pull can open connection database?

i found answer here. datasource bean injected regular artefacts can accessed through applicationcontext this:

def datasource = applicationcontext.getbean('datasource') 

Comments