flex4+sdk4+spring3+hibernate3整合開發

所需環境:

flex4

sdk4

spring3

hibernate3

eclipse3.4

jdk1.6

tomcat6以上(必須是安裝版)

 

spring配置文件:

  <?xml version="1.0" encoding="UTF-8" ?>

- <beans xmlns="http://www.springframework.org/schema/beans" xmlns:flex="http://www.springframework.org/schema/flex" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/flex http://www.springframework.org/schema/flex/spring-flex-1.0.xsd">
  <flex:message-broker />
- <bean id="testService" class="com.longtop.test.TestService">
  <flex:remoting-destination />
  <property name="testDao" ref="testDao" />
  </bean>
- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  <property name="url" value="jdbc:mysql://localhost:3306/test" />
  <property name="username" value="root" />
  <property name="password" value="root" />
  </bean>
- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="dataSource">
  <ref bean="dataSource" />
  </property>
- <property name="mappingResources">
  <value>com/longtop/test/Person.hbm.xml</value>
  </property>
- <property name="hibernateProperties">
- <props>
  <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
  </props>
  </property>
  </bean>
- <bean id="testDao" class="com.longtop.test.TestDaoImp">
- <property name="sessionFactory">
  <ref bean="sessionFactory" />
  </property>
  </bean>
  </beans>
web.xml:
<?xml version="1.0" encoding="UTF-8" ?>
- <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <display-name>test</display-name>
- <servlet>
  <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <init-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/classes/application-*.xml</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
  </servlet>
- <servlet-mapping>
  <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
  <url-pattern>/messagebroker/*</url-pattern>
  </servlet-mapping>
- <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.htm</welcome-file>
  <welcome-file>index.jsp</welcome-file>
  <welcome-file>default.html</welcome-file>
  <welcome-file>default.htm</welcome-file>
  <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
<!--
 for WebSphere deployment, please uncomment 
  -->
  </web-app>
源碼地址:
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章