考虑我可以写在resources.xml:
<bean id="beanOne" class="ExampleBean" depends-on="manager,accountDao"/>
我会在resources.groovy. 如何编写depends-on指令?
考虑我可以写在resources.xml:
<bean id="beanOne" class="ExampleBean" depends-on="manager,accountDao"/>
我会在resources.groovy. 如何编写depends-on指令?
beanOne(ExampleBean) { bean ->
bean.dependsOn = ['manager', 'accountDao']
}
应该做你所追求的。大多数<bean>属性都有bean.XXX等价物,包括init-method, destroy-method, factory-bean, factory-method, autowire- 只需使用驼峰式大小写而不是连字符(例如bean.initMethod = "...")。如果这不起作用,那么bean.beanDefinition将为您提供对实际 SpringBeanDefinition对象的引用,以便您可以调用它的其他方法。
我认为更好的是至少对通过服务插件创建的服务使用org.springframework.context.annotation.DependsOnresources.groovy注释,而不是通过.