`

Flex3 + Blazeds+Spring2.5+Hibernate3.2 整合

阅读更多

分两工程创建,当然也可创建一个工程就可以

 

CMS Java Project Configuration

1 Create a java web project named CMS,its JavaEE specification level:JavaEE5.0

2 set file encoding

open IDE,choose Window-->Preferences menu to set all relevant files' encoding.

3 Add packages for CMS project according to Development Convensions.

4 add Spring2.5 capability and put its applicationContext.xml config file into the WEB-INF folder

5 add Hibernate3.2 capability,choose existed spring config file instead of hibernate config file

6 modify spring2.5 config file

6.1 replace the file header by using the following code:

 

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

<beans xmlns="http://www.springframework.org/schema/beans"

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-2.5.xsd

http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd

http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

 

 

6.2 add the following code in applicationContext.xml file

 

 

<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

<property name="dataSource" ref="dataSource" />

</bean>

<!-- the transactional advice (what 'happens'; see the <aop:advisor/> in others config file) -->

<tx:advice id="txAdvice" transaction-manager="txManager">

<!-- the transactional semantics... -->

<tx:attributes>

<!-- all methods starting with 'get' are read-only -->

<tx:method name="get*" read-only="true" />

<tx:method name="find*" read-only="true"/>

<!-- other methods use the default transaction settings (see below) -->

<tx:method name="*" />

</tx:attributes>

</tx:advice>

 

7 in the folder WEB-INF/config,add a new config file for module clinic,named clinic-applicationContext.xml.See also the file in the CMS project.

 

8 Add blazeDS capability

copy the lib required by blazeDS into the WEB-INF/lib folder,and copy the whole folder flex into the WEB-INF folder.

9 Modify the web.xml

add the following code:

<display-name>BlazeDS</display-name>

<description>BlazeDS Application</description>

<!-- spring support -->

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/applicationContext.xml,/WEB-INF/config/clinic-applicationContext.xml</param-value>

</context-param>

<listener>

<listener-class>

org.springframework.web.context.ContextLoaderListener

</listener-class>

</listener>

<!-- Http Flex Session attribute and binding listener support -->

<listener>

<listener-class>flex.messaging.HttpFlexSession</listener-class>

</listener>

 

<!-- MessageBroker Servlet -->

<servlet>

<servlet-name>MessageBrokerServlet</servlet-name>

 

<servlet-class>

flex.messaging.MessageBrokerServlet

</servlet-class>

<init-param>

<param-name>services.configuration.file</param-name>

<param-value>/WEB-INF/flex/services-config.xml</param-value>

</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

 

<servlet-mapping>

<servlet-name>MessageBrokerServlet</servlet-name>

<url-pattern>/messagebroker/*</url-pattern>

</servlet-mapping>

 

 

 

10 modify the services-config.xml file in the flex folder

 

append the following code

 

<factories>

<factory id="spring" class="com.versionsystem.framework.factory.SpringFactory.SpringFactory" />

</factories>

 

SpringFactory class references blazeds document

 

11 add log4j.properties file in the src folder,which will be used by log4j.

12 replace asm-2.2.3.jar,asm-commons-2.2.3.jar,asm-util-2.2.3.jar,asm.jar,asm-attrs.jar with asm-all.jar

 

 

 

 

 

 

 

CMS-Client Project Configuration

1create a flex project named CMS-Client

2 add folders according to Development Convensions

3add internationalization file

4create a folder named locale under the CMS-Client project,and add two folders in the locale folder:en_US,zh_CN.There is a properties file in every locale's sub-folder.

 



 
 

Open project CMS-Client properties window,add a folder according to following diagram:

 


 
 

5Add additional compiler arguments

-locale en_US zh_CN





 
 
 

6.Flex Server Configuration

 

 

 

  • 大小: 34 KB
  • 大小: 19.6 KB
  • 大小: 48.8 KB
  • 大小: 53.5 KB
0
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics