Accessing flow frm flow scoped service
Hello I am relative new to Grails and struggle using webflow. I created a flow scoped service
Code:
class MyService implements Serializable{
static scope = "flow"
static transactional = false
def counter = 0
def serviceMethod() {
this.counter++
log.debug("SERVICE METHOD CALLED ${this.counter} times")
}
...
I call this service from a controller web flow
Code:
...
stepTwo {
on("previous") {
flow.myVar="HELLO"
log.debug("JUST HIT previous at STEP TWO")
myService.serviceMethod()
}.to("processOne")
on("cancel").to("finish")
on("finish"){
log.debug("JUST HIT finish at STEP TWO")
myService.serviceMethod()
}.to("finish")
}
...
I was under the impression that I would be able to access flow scoped variables in my service using
But I can't seem to access the flow object. I get a "No such property: flow for class: MyService". Does anybody know if this is the correct behavior or a bug? I read "Grails in Action" and the book also shows such an example.