简体   繁体   中英

Reference grailsApplication in resources.xml or other xml

Is there any way to reference grailsApplication from either resources.xml or a different xml file that is imported by resources.groovy?

For example, I am wiring up some beans in foo.xml that will be imported in resources.groovy. I would like to pull in some values from the external config, so it would be nice if I could do something like:

<bean id=fooBean class="com.beans.foo.FooBean">
    <property name="exVar" value="${grailsApplication.config.some.path.to.ext.variable}"
</bean>

I've done this quite a bit in resources.groovy, so was wondering if there were a way to get at this object from xml. Thanks!

Looking at this related question you can use:

<bean id=fooBean class="com.beans.foo.FooBean">
    <property name="exVar" value="${some.path.to.ext.variable}"
</bean>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM