国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
webwork+spring最簡單的集成
xwork-option項目中,新增了一種更簡單的實現(xiàn)WebWork和Spring集成的方案。它只要一個攔截器ActionAutowiringInterceptor就可以搞定!并且是自動為Action組裝它所需的Spring容器中的Bean,也就是不用在每個Action中逐個配置所需的Bean。
配置步驟:
1、在Web.xml文件中配置Spring Application Context:
java代碼: 


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


2、在xwork.xml文件中定義ActionAutowiringInterceptor,并配置到相應的Action中:
java代碼: 


<interceptor name="autowire" class="com.opensymphony.xwork.spring.interceptor.ActionAutowiringInterceptor">
    <param name="autowireStrategy">
@org.springframework.beans.factory.config.AutowireCapableBeanFactory@AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE
    </param>
  </interceptor>


可以自己設置Bean組裝的策略,上面的定義是根據(jù)類型組裝。如果不設置,默認情況是根據(jù)Bean的名稱組裝。
詳細參考:http://wiki.opensymphony.com/display/WW/WebWork+2+Spring+Integration
ActionAutowiringInterceptor主要代碼如下:
java代碼: 


protected void before(ActionInvocation invocation) throws Exception {
    if (!initialized) {
      ApplicationContext applicationContext = (ApplicationContext)ActionContext.getContext().getApplication().get(
          WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);

      if (applicationContext == null) {
        log.warn("ApplicationContext could not be found.  Action classes will not be autowired.");
      } else {
        setApplicationContext(applicationContext);
        factory = new SpringObjectFactory();
        factory.setApplicationContext(getApplicationContext());
        if (autowireStrategy != null) {
          factory.setAutowireStrategy(autowireStrategy.intValue());
        }
      }
      initialized = true;
    }
   
    if (factory == null)
      return;

    Action bean = invocation.getAction();
    factory.autoWireBean(bean);
   
    ActionContext.getContext().put(APPLICATION_CONTEXT, context);
  }

本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Webwork 與spring集成研究(未完)
Flex Spring Hibernate整合
Spring Boot 2.0(七):SpringApplication 深入探索
Spring獲取Bean的幾種方式
spring在代碼中獲取bean的幾種方式
webwork+spring+hibernate
更多類似文章 >>
生活服務
分享 收藏 導長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服