麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 開發設計 > 正文

SpringVS.HiveMind優點缺點大比拼

2019-11-18 13:49:27
字體:
來源:轉載
供稿:網友

  在如下方面HiveMind優于SPRing:
  
  * HiveMind強制針對接口編程;
  
  * HiveMind使用module概念來分組治理service,利于并行和迭代開發;
  
  * HiveMind使用的配置文件格式更清楚簡明,非凡是將接口和實現統一定義成1個service,而Spring可能要定義好幾個bean元素;
  
  * 在增加或移去interceptor時,HiveMind只要修改1行配置文件,而Spring至少要修改兩個bean元素;
  
  * 在定義interceptor時,HiveMind采用javassist類庫,性能優于Spring采用的JDK proxy。
  
  在如下方面Spring優于HiveMind:
  
  * Spring的AOP框架較為成熟,編寫interceptor的難度較低。
  
  * Spring內建和Hibernate的集成,HiveMind尚未內建該集成。
  
  * Spring的transaction management支持各種transaction API,如JDBC、JDO、JTA等等。
  
  基于以上發現,建議在下一項目中采用HiveMind。因為已經自行開發了HiveMind和Hibernate的集成以及簡單的transaction management代碼,因而在下一項目中并不非凡需要Spring的相應功能。不過,當前HiveMind是1.0-rc2版,一旦發布1.0-release版則應盡快升級。
  
  [Spring VS. HiveMind]:
  
  * Service Oriented?
  Spring : Yes.
  HiveMind : Yes.
  
  * How to define a Service?
  Spring :
  Define a POJO. (在Spring術語中稱之為bean,但實際上是POJO。)
  
  配置文件:<bean id="exampleBean" class="examples.ExampleBean"/>
  HiveMind:
  Define an interface and core implementation POJO.
  
  配置文件:service-point元素。
  Comments:
  HiveMind強制針對接口編程,優于Spring。
  
  * 是否提供service的namespace?
  Spring:
  僅僅使用id屬性來唯一識別service。
  支持多配置文件。
  HiveMind:
  提供Module概念用于治理service namespace,類似于java中的package。
  支持多個配置文件。
  Comments:
  HiveMind略優。
  
  * Service Lifecycle?
  Spring:
  2 Lifecycle models: Singleton, Prototype.
  HiveMind:
  4 Lifecycle models: Primitive, Singleton, Threaded, Pooled.
  Comments:
  最常用的就是Singleton模型。雖然HiveMind模型多于Spring,但不構成優勢。
  
  * Who manages service?
  Spring: BeanFactory or applicationContext.
  HiveMind: Registry.
  
  * Dependency Injection?
  Spring: yes. type-2 and type-3 supported.
  HiveMind: yes. type-2 and type-3 supported.
  
  * Service Depenency Injection?
  Spring:
  使用ref元素。
  <property name="beanOne"><ref bean="anotherExampleBean"/></property>
  HiveMind:
  在配置文件中使用set-service元素。
  <set-service service-id="anotherService"/>
  Comments:
  在更換實現時,HiveMind因強制針對接口編程而占有優勢。
  
  * Intializing and finalizing methods?
  Spring :
  <bean id="exampleInitBean" class="examples.ExampleBean"
  init-method="init()"
  destroy-method="cleanup()"/>
  />
  HiveMind:
  <constrUCt class="..." initialize-method="..."/>
  不支持finalizing method。
  Comments:
  Spring略優。
  
  * How to configure AOP?
  Spring:
  <!-- Step 1 : 定義核心實現 -->
  <bean id="personTarget" class="com.mycompany.PersonImpl">
  <property name="name"><value>Tony</value></property>
  <property name="age"><value>51</value></property>
  </bean>
  <!-- Step 2 : 定義Interpreter -->
  <bean id="myAdvisor" class="com.mycompany.MyAdvisor">
  <property name="someProperty"><value>Custom string property value</val></property>
  </bean>
  <bean id="debugInterceptor" class="org.springframework.aop.interceptor.Nop
  
  Interceptor">
  </bean>
  <!-- Step 3 : 定義接口 -->
  <bean id="person"
  class="org.springframework.aop.framework.ProxyFactoryBean"
  >
  <property name="proxyInterfaces"><value>com.mycompany.Person</value></
  
  property>
  <property name="target"><ref local="personTarget"/></property>
  <!-- Step 4 : 聲明引用 interpreter -->
  <property name="interceptorNames">
  <list>
  <value>myAdvisor</value>
  <value>debugInterceptor</value>
  </list>
  </property>
  </bean>
  
  HiveMind:
  <!-- 定義接口 -->
  <service-point id="Adder" interface="slhynju.doconline.business.Adder">
  <!-- 構造核心實現 -->
  <invoke-factory>
  <construct class="slhynju.doconline.business.AdderImpl">
  <set-service property="sessionSource" service-id="SessionSource" />
  </construct>
  </invoke-factory>
  <!-- 聲明引用 interpreter -->
  <interceptor service-id="hivemind.LoggingInterceptor"/>
  <interceptor service-id="TransactionInterceptor"/>
  </service-point>
  Comments:
  Spring將接口和核心實現分開定義成兩個bean,HiveMind則統一定義成一個service。
  
  這點上HiveMind優于Spring。
  
  Spring的AOP框架較為成熟。HiveMin的Interpreter factory仍需要降低編寫難度。
  
  HiveMind采用javassist,性能上優于Spring采用JDK proxy。
  
  * How to configure declarative transaction management?
  
  Spring: 采用AOP。
  
  <bean id="petStoreTarget" class="org.springframework.samples.jpetstore.dom
  
  ain.logic.PetStoreImpl">
  <property name="accountDao"><ref bean="accountDao"/></property>
  <!-- Other dependencies omitted -->
  </bean>
  
  <bean id="petStore"
  class="org.springframework.transaction.interceptor.TransactionProxyFac
  
  toryBean">
  <property name="transactionManager"><ref bean="transactionManager"/></
  
  property>
  <property name="target"><ref local="petStoreTarget"/></property>
  <property name="transactionAttributes">
  <props>
  <prop key="insert*">PROPAGATION_REQUIRED</prop>
  <prop key="update*">PROPAGATION_REQUIRED</prop>
  <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
  </props>
  </property>
  </bean>
  
  HiveMind: 沒有內建支持。我自行開發了一個TransactionInterceptor
  <interceptor service-id="TransactionInterceptor">
  <include method="add*"/>
  </interceptor>
  
  Comments:
  在Spring中假如需要混合使用TransactionInterceptor和其他Interceptor,需要定義多個bean。增大了維護成本。
  Spring支持JTA等各種Transaction manager。
  HiveMind配置文件更加清楚簡明。但不沒有提供JTA集成很致命。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 国产精品剧情一区二区三区 | 7777在线视频免费播放 | 国产三级a三级三级 | 国产成人自拍小视频 | 日本a级一区 | 国产成人在线免费观看视频 | 精品在线一区二区三区 | 午夜精品久久久久久久爽 | 亚洲特黄a级毛片在线播放 久久久入口 | 欧美一级美片在线观看免费 | 国产精品一区在线看 | 日韩黄色在线播放 | 日韩黄色片在线观看 | 国产羞羞视频在线观看免费应用 | 九九热视频免费在线观看 | 成年性羞羞视频免费观看无限 | 国产无遮挡一级毛片 | 国产精品二区高清在线 | 国产免费人做人爱午夜视频 | 最新在线黄色网址 | av在线影片 | 亚洲精品一区中文字幕 | 最新一区二区三区 | 日本成人午夜视频 | 在线成人av观看 | 久久精品中文字幕一区 | 日韩黄a| 国产精品久久久久久婷婷天堂 | 成人免费一区二区三区在线观看 | 国产一级毛片高清视频完整版 | 色综合激情 | 国产一级在线观看视频 | 91成人在线免费观看 | 蜜桃久久一区二区三区 | 欧美人xx| 久久久国产精品免费观看 | 精品一区二区三区四区在线 | 久色porn | 欧美老外a级毛片 | 久久亚洲美女视频 | 久久久久久亚洲国产精品 |