/ Published in: Groovy
Created this to generate file:/ script path for Groovy Refreshable Spring Beans
for use in applicationContext.groovy because refresh feature wouldn't work
when Groovy script is looked up on classpath.
for use in applicationContext.groovy because refresh feature wouldn't work
when Groovy script is looked up on classpath.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// applicationContext.groovy import org.springframework.scripting.groovy.GroovyScriptFactory import org.springframework.scripting.support.ScriptFactoryPostProcessor import org.codehaus.groovy.grails.commons.spring.DefaultBeanConfiguration //////////////////////////////////////////////////////////// // Created this to generate script path for Groovy Refreshable Spring Beans // for use in applicationContext.groovy because refresh feature wouldn't work // when Groovy script is looked up on classpath. // e.g. sample arg 'src/main/resources/USA.groovy' when running gradle runJetty task in IDEA. } // try again // special case // note: refresh feature will probably not work in this case } } //////////////////////////////////////////////////////////// beans { importBeans('classpath:applicationContext.xml') // setup refreshable usa bean usa(GroovyScriptFactory, USAscriptUriPath) { DefaultBeanConfiguration bean -> capital = 'Washington, D.C.' population = 617996 bean.beanDefinition.setAttribute( ScriptFactoryPostProcessor.REFRESH_CHECK_DELAY_ATTRIBUTE, 5000 ) } scriptFactoryPostProcessor(ScriptFactoryPostProcessor) { defaultRefreshCheckDelay = 5000 } }