grails - Is that possible to read data from Database into Config.groovy? -
i need to read data database read config.groovy.
is possible data database config.groovy?
no not possible. in sequence of events when grails application starting config.groovy processed before datasource made available application.
without knowing trying accomplish can't make suggestion on how else approach issue.
updated (based on comment)
in comment explain trying use feature switch plugin (which designed run time , not persistent). looking @ source code plugin should able make own service load settings database , toggles/updates feature switch settings. here simple sketch/example:
package example import org.springframework.beans.factory.initializingbean class myexampleservice implements initializingbean { def grailsapplication void afterpropertiesset() { // here whatever needed load settings grailsapplication.config.features['somefeature'].enabled = true grailsapplication.config.features['otherfeature'].enabled = false } }
that should @ least give idea.
alternatively write in bootstrap.groovy
can access datasource/gorm well.
Comments
Post a Comment