Spring Web Flow Bean 作用域和 JSF
我最近完成了 Spring Web Flow 中一个有趣的问题。这个问题 (SWF-163) 涉及为 Spring Web Flow 的内部作用域添加 Spring 2.0 Bean 作用域支持。实现过程本身并不是特别有趣(毕竟 Scope 接口实现起来相当容易),但我想要具体说明一下如何在你的应用中使用类似功能。
Spring 2.0 作用域
在 Spring 1.x 中,我们有 singleton 和 prototype bean 作用域的概念,但表示法是固定的,并且使用 singleton="[true | false]" 不是特别有描述性。因此在 Spring 2.0 中,这种表示法从 XSD 风格的配置中移除,现在你看到了更清晰的表示法 scope="[singleton | prototype | ...]"。Spring 本身添加了另外三个与 Web 应用相关的 Bean 作用域:request、session 和 globalSession。随着 Spring Web Flow 1.1 的最新快照版本发布,我们现在可以看到三个主要的 Web Flow 作用域的 Bean 作用域:flash、flow 和 conversation。
<bean id="sale" class="org.springframework.webflow.samples.sellitem.Sale…