日期:2014-05-16  浏览次数:20397 次

DelegatingVariableResolver Spring 和JSF的结合使用
配置文件 faces-config.xml 如下:
 <application>
   ...
   <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
 </application>

 <managed-bean>
   <managed-bean-name>myJsfManagedBean</managed-bean-name>
   <managed-bean-class>example.MyJsfManagedBean</managed-bean-class>
   <managed-bean-scope>session</managed-bean-scope>
   <managed-property>
     <property-name>mySpringManagedBusinessObject</property-name>
     <value>#{mySpringManagedBusinessObject}</value>
    //受管的Bean配置属性mySpringManagedBusinessObject依靠Spring注入创建
   </managed-property>
 </managed-bean>

applicationContext.xml配置:
 <bean id="mySpringManagedBusinessObject" class="example.MySpringManagedBusinessObject">
   ...
 </bean>