0
我在我的控制器中有WebFlow和簡單的流程範圍服務。在我的Web流程結束的某個地方,我需要根據我之前在Web流程中收到的值驗證我的命令對象字段。爲此,我創建了一個簡單的流量範圍的服務:在grails服務中訪問流程範圍
class EventFlowService implements Serializable {
static transactional = false
static scope = "flow"
Date getEventStartDate(){
flow.basicData.eventDate
}
}
我不需要我的服務在其他地方比在命令對象,所以我把它注入到我的命令對象,像這樣:
class EventRestrictionsCommand implements Serializable{
def eventFlowService
boolean onlineRegistration
Date onlineRegistrationEnd
Date onlineRegistrationStart
static constraints = {
onlineRegistrationEnd validator: {val, obj ->
if(obj.onlineRegistration){
return val > obj.onlineRegistrationStart || val <= obj.eventFlowService.getEventStartDate()
}
return null
}
}
}
問題是我收到異常說,我的服務中沒有flow
屬性。有什麼方法可以訪問我的流程範圍服務中的流量存儲?