user1920760
user1920760

Reputation: 9

dynamic schema value to DataSource.groovy

Is it possible to send dynamic values from Controller/Domain classes to DataSource.groovy? Ex: default_schema = ${someConfig.default_schema}

Upvotes: 1

Views: 264

Answers (1)

coderLMN
coderLMN

Reputation: 3076

Not possible. DataSource is loaded when the app starts up. There is no way to change this configuration in the run-time.

If your objective is to externalize Datasource configuration, you can use JNDI like:

dataSource {
    jndiName = "java:comp/env/myDataSource"
}

and define the data source in web-app/META-INF/context.xml.

Upvotes: 1

Related Questions