是否可以将Spring bean注入到Grails webflow中?我尝试以下依赖项注入Grails Webflow
class CheckoutController {
ShoppingService shoppingService
def checkoutFlow = {
start {
action {
// This attempt to access the service doesn't work
flow.addresses = shoppingService.getOrder()
}
}
}
}
我可以从常规控制器动作访问shoppingService
,但我不能从一个Webflow(见上文)的动作访问它。
你会得到什么错误?我的猜测是,WebFlow会尝试将所有访问的Domain对象存储在流程范围中,并出现一些奇怪的错误。 – sbglasius
该服务为空,因此当我尝试访问该服务时,我得到了一个NPE。此代码中没有涉及域对象 –