欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
Webwork 與spring集成研究(未完)
 

Webwork spring集成研究

一、   webworkspring的集成方式

webwork2.2中引入了新的webworkspring的集成方式,方法如下:

1)      spring.jar 添加到classpath

2)      webwork.properties中做如下改動(dòng):

webwork.objectFactory = spring,spring默認的對象裝配模式是通過(guò)name,如果想改變,webwork.objectFactory.spring.autoWire = type

3)      web.xml中添加如下內容

<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener

</listener-class>

</listener>

4)      創(chuàng )建一個(gè)spring的配置文件ApplicationContext,其位置信息可以添加到web.xml中,如下

<!-- Context Configuration locations for Spring XML files -->

<context-param>

<param-name>contextConfigLocation</param-name>    <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>

</context-param>

通常,我們在xwork.xml中未每一個(gè)action指定了類(lèi),當使用了SpringObjectFactory后,webwork會(huì )要求spring來(lái)創(chuàng )建action并根據指定的自動(dòng)裝配方式來(lái)為action裝配屬性。SpringObjectFactory同時(shí)也會(huì )在bean上應用所有的后續處理,比如代理action(為了控制事務(wù)),安全性等等。

參考:We strongly recommend that you find declarative ways of letting Spring know what to provide for your actions. This includes making your beans able to be autowired by either naming your dependent properties on your action the same as the bean defined in Spring which should be provided (to allow for name-based autowiring), or using autowire-by-type and only having one of the required type registered with Spring. It also can include using JDK5 annotations to declare transactional and security requirements rather than having to explicitly set up proxies in your Spring configuration. If you can find ways to let Spring know what it needs to do for your action without needing any explicit configuration in the Spring applicationContext.xml, then you won‘t have to maintain this configuration in both places.

 

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

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans default-autowire="autodetect">

    <bean id="bar" class="com.my.BarClass" singleton="false"/>

    ...

</beans>

注意: the id attribute in the spring configuration corresponds to the class attribute in the xwork configuration. Also note that in the spring configuration, the singleton attribute is set to false. This would generally be the case that is desired as Webwork creates a new action class upon each request. Hence when Spring integration is used, this would be the desired behaviour. Making Springs singleton attribute false would allow this.

注意,因為webworkaction是線(xiàn)程安全的,對于每一個(gè)request,webwork都會(huì )創(chuàng )建一個(gè)新的action實(shí)例來(lái)處理。但是spring默認的bean創(chuàng )建方式是采用單例模式的,即在默認方式下,spring會(huì )創(chuàng )建一個(gè)bean對象,然后服務(wù)于所有的請求。要在兩者之前達成一致,最好將singleton="false"

二、   webworkspring的分工

1、 webwork的工作,總得來(lái)說(shuō)是提供一個(gè)流程的控制:

Ø         通過(guò)UI tag接收用戶(hù)請求,將基于http的請求參數和相關(guān)的環(huán)境變量封裝到通用的ActionContext

Ø         Xwork接收到webwork傳遞過(guò)來(lái)的actionContext,放入valueStack

Ø         請求spring將創(chuàng )建action對象,裝配action的屬性(SpringObjectFactory

Ø         執行攔截器before()方法,執行actionexecute()方法,執行攔截器after()方法

Ø         執行result,返回給客戶(hù)端結果

2、 Spring的工作,主要是解決對象之間的依賴(lài)問(wèn)題

Ø         創(chuàng )建action對象,為其裝配相關(guān)的類(lèi)成員變量,比如Dao類(lèi),事務(wù)控制

 

 

三、   對于事務(wù)以及其他spring特性的使用

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
webwork2 + spring 結合的幾種方法的小結
struts2+spring的兩種整合方式
第3章 Spring Bean的裝配模式
spring面試題
使用MyEclipse部署SSH框架
spring 編程入門(mén)十大問(wèn)題解答
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久