Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You could try setting your bean definitions in <code>Config.groovy</code>, using its built in <code>environments {}</code> handling, and assigning the definitions via the <code>application</code> property.</p> <p>So in <code>resources.groovy</code>:</p> <pre><code>beans = { // Create a clone of the properties definition Closure def cacheProps = application.config.cache.bean.props.clone() cacheProps.delegate = this cacheBean(application.config.cache.bean.class, cacheProps) } </code></pre> <p>And in <code>Config.groovy</code>:</p> <pre><code>environments { production { cache.bean.class = com.util.OracleCacheImpl cache.bean.props = { //properties as in resources.groovy } } 'local' { cache.bean.class = com.util.MockMapCache cache.bean.props = { //properties as in resources.groovy } } 'uat' { //etc... } //etc... } </code></pre> <p>Thinking a little longer on it, you could probably put the whole bean definition in a <code>Config.groovy</code> <code>Closure</code> and call it in resources.groovy</p> <p><code>resources.groovy</code></p> <pre><code>beans = { // Create a clone of the properties definition Closure def cacheBeans = application.config.cache.beans.clone() cacheBeans.delegate = this cacheBeans() } </code></pre> <p><code>Config.groovy</code></p> <pre><code>environments { production { cache.beans = { cacheBean(com.util.OracleCacheImpl) { //properties here } } } 'local' { cache.beans = { cacheBean(com.util.MockMapCache) { //properties here } } } 'uat' { //etc... } //etc... } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload