In order to inject conversation scoped objects into JSF backing beans, I currently do the following :
Define a request based backing bean in faces-config, use setter injection to inject #{someObject} (defined as a conversation scoped variable in my flow definition)
My flow definition defines the someObject variable in conversation scopeCode:<managed-bean> <managed-bean-name>backingbean</managed-bean-name> <managed-bean-class>com.acme.backingbean</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>someObject</property-name> <value>#{someObject}</value> </managed-property> </managed-bean>
My spring beans configuration contains the definition of the someObject beanCode:<flow> <var name="someObject" scope="conversation"/> ... </flow>
For every request, the backing bean get's re-created, and injected with the same conversation scoped object during the flow (behavior that I want).Code:<beans> <bean id="someObject" class="com.acme.SomeObject" scope="prototype"/> ... </beans>
Suppose I don't want to use faces-config to define my backing beans, but I want to use spring beans as backing beans, how do I inject the flowscoped someObject into the spring bean ?
I removed the entry in faces-config.xml, and defined the backing bean in my spring beans configuration :
Spring allows me to refer to #{backingbean} via EL without a problem, but how do I inject someObject ? What do I need to put as a ref or value attribute ? If a use ref="someObject", I get a new someObject injected on every request. How do I tell Spring to lookup the conversation scoped object belonging to my flow (as is the case when the backing bean is configured in faces-config) ?Code:<bean id="backingbean" class="com.acme.backingbean" scope="request"> <property name="someObject" ref="???"/> </bean>


Reply With Quote