您的位置:首页 > 编程语言 > Java开发

flex4+sdk4+spring3+hibernate3整合开发

2011-06-27 14:15 309 查看
所需环境:

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>

源码地址:
http://download.csdn.net/source/3398473
http://download.csdn.net/source/3398594
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息