Consider I can write that in resources.xml
:
<bean id="beanOne" class="ExampleBean" depends-on="manager,accountDao"/>
I would write it using Spring DSL in resources.groovy
. How to write depends-on
directive?
beanOne(ExampleBean) { bean ->
bean.dependsOn = ['manager', 'accountDao']
}
should do what you're after. Most of the <bean>
attributes have bean.XXX
equivalents, including init-method
, destroy-method
, factory-bean
, factory-method
, autowire
- just use camel case instead of hyphens (e.g. bean.initMethod = "..."
). If that doesn't work then bean.beanDefinition
will give you a reference to the actual Spring BeanDefinition
object so you can call its other methods.
I think better is to use org.springframework.context.annotation.DependsOn annotation at least for services created via services plugin, not via resources.groovy
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With