gregsoulsby (30) [Avatar] Offline

The book mentions webflows, but does not go into details. I think webflow is very important - I wish Roo generated its view layer in it rather than controllers.

The Roo generation of the skelleton flow works fine.

My problem is how to use the Roo generated classes in a flow.

Within say <on-start> the expression might be

expression="new com.a.b.repositiory.MyclassRepository()"

but this gives me a message about invalid constructor.

When I bring in a service I get null pointer exception on things autowired, which I take to mean they are not being autowired.

There is a "bean" option on the STS webflow form, but this invalidates the flow.xml.

Can you advise on optons?

ken.rimple (246) [Avatar] Offline
Re: Getting workflow going - how to?
Key things:

1) In your expression evaluations, you will use the component name of the @Component or @Service you're trying to inject. It lowercases the first letter, and names it on the class you annotate, so if you have:

public class AccountManagerImplBean implements AccountManager

the name will be accountManagerImplBean.

You can override with


You do not reference a new of anything, nor the package/class name. it has to be a Spring Bean in this case above.

2) Spring will import everything into the naming space - including the bean names of the spring context, all of the scopes (request, session, flow and other scopes) etc... So it should find the bean.

3) You can treat the expressions like other ELs. In the Spring WebFlow guide I believe it lists some sample expressions.

4) You do not need to instantiate the Spring beans in the on-start. Unless you want to create your own bean of a particular instance (for state information), don't bother. They will be injected.

So you can do:

<evaluate expression="myRepository.findAllCheeseburgers()" result="flowScope.cheeseburgerList" />

You can also pass it flowRequestContext, which is a variable of type RequestContext. This contains all scope data so you can then pluck out a scope in your bean method and store / get things from it. See


Message was edited by:
gregsoulsby (30) [Avatar] Offline
Re: Getting workflow going - how to?

You are both fast and good.

Many thanks, that is more than helpful.

ken.rimple (246) [Avatar] Offline
Re: Getting workflow going - how to?
I'll take that compliment!

Any time, Greg!