关键点:(1)修改web.xml,添加<context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener </listener-class> </listener> (2) 修改service-config.xml,添加factory元素,指向SpringFactory工厂类。 <factories> <factory id="spring" class="flex.samples.factories.SpringFactory" /> </factories> (3)添加applicationContext.xml,添加Spring管理的类。 <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans> <bean id="rateFinderBean" class="flex.samples.spring.mortgage.SimpleRateFinder" /> <bean id="mortgageBean" class="flex.samples.spring.mortgage.Mortgage"> <property name="rateFinder" ref="rateFinderBean" /> </bean></beans> (4)修改remoting-config.xml,添加和前台通信的类。 <destination id="mortgageService"> <properties> <factory>spring</factory> <source>mortgageBean</source> </properties> </destination>
(5)将SpringFactory和其它用到的类添加到相应的目录。