【发布时间】:2009-11-04 17:28:55
【问题描述】:
假设我在 grails-app/services 下有一个 BarService,在 src/groovy 下有一个像这样的常规 Groovy 类 'Foo'。
class Foo {
def barService
}
有没有办法在运行时以编程方式将其转换为 Spring bean?澄清一下,我想将 BarService 的引用注入到 barService 字段中。
def fooInstance = new Foo()
magic-create-spring-bean-function(fooInstance)
assert fooInstance.barService
【问题讨论】:
标签: grails dependency-injection