Is there an a way to initialise some data in a Plugin. I am modulizing my code and it would be nice to have something like the bootstrap in the Plugin but I cannot find it. Nor can I find references using the Google.
Is there an equivalent to the Bootstrap class in a Plugin
Asked Answered
BootStrap.groovy is excluded by default from a plugin zip, but you can create a MyPluginBootStrap.groovy (name doesn't matter, just can't be BootStrap) and that'll be packaged and run along with the application's BootStrap.
plugin init stuff in doWithApplicationContext() . more details from grails.1312388.n4.nabble.com/… –
Jarlath
Name does matter in that it needs to be different from any other XXXBootStrap.groovy that you want to be run on application startup. If two plugins have a BootStrap with the same name only one will be executed, therefor MyPluginNameBootStrap.groovy seems a save choice. –
Silverside
I tried this, created MyPluginBootStrap in my project (in the same place that boostrap would live), but it never gets called, only the applications bootstrap. Any ideas? This is in intellij (not war) –
Subfloor
The structure of the file is important. Example filename:
MyPlugBootStrap.groovy
. Content: ` class MyPlugBootStrap { def init = { println('something') } } ` I've tried to use this file as script without class and application silently died. In general structure should be the same as in BootStrap.groovy
in main application. –
Hegumen © 2022 - 2024 — McMap. All rights reserved.