gpt4 book ai didi

grails - Grails 中 Spring XML "depends-on"属性的 Spring DSL 等效项是什么

转载 作者:行者123 更新时间:2023-12-02 09:18:05 25 4
gpt4 key购买 nike

考虑一下我可以将其写入resources.xml:

<bean id="beanOne" class="ExampleBean" depends-on="manager,accountDao"/>

我会在 resources.groovy 中使用 Spring DSL 编写它。如何编写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会给你一个实际Spring的引用 BeanDefinition 对象,以便您可以调用它的其他方法。

关于grails - Grails 中 Spring XML "depends-on"属性的 Spring DSL 等效项是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18788831/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com