I'm creating a Grails plugin which will modify the value of the following config property:
grails.gorm.default.constraints
The problem is that by the time my plugin descriptor starts running (doWithSpring) if the Grails application that uses the plugin had an existing value for the default constraints property, it would have been already executed.
I'd like my plugin to modify the value of the default constraints before Grails begins executing it so that the constraints I'm adding will also be included. The default constraints closure seems to get executed multiple times during Grails app startup.
I've tried a few approaches:
- Use the platform-core plugin which this post talks about: How to configure a grails plugin from another grails plugin.
- Problem there is similar: the Grails app's default constraints block is executed at least once before the plugin's doWithConfig begins to run.
- (Hackish) Modify Grails app to include a FooConfig.groovy in its "locations", a file which exists in the plugin's grails-app/conf/ dir and thus accessible on the classpath (see below).
- Problem: Hackish, still working through it but might be my only option.
grails.config.locations = ["classpath:FooConfig.class"] // Yes, *.class