2011-03-10 49 views
1

我目前需要在春季非常詳細的安裝框架:建設一個自定義的框架Spring配置標籤

<bean id="dpHibernateRemotingAdapter" 
      class="org.springframework.flex.core.ManageableComponentFactoryBean"> 
      <constructor-arg value="org.dphibernate.adapters.RemotingAdapter" /> 
      <property name="properties"> 
        <value> 
          {"dpHibernate" : 
          { 
          "serializerFactory" : "org.dphibernate.serialization.SpringContextSerializerFactory" 
          } 
          } 
    </value> 
      </property> 
    </bean> 
    <bean id="dataAccessService" class="org.dphibernate.services.SpringLazyLoadService" 
      autowire="constructor"> 
      <flex:remoting-destination /> 
    </bean> 
    <bean id="dpHibernateSerializer" class="org.dphibernate.serialization.HibernateSerializer" 
      scope="prototype"> 
      <property name="pageSize" value="10" /> 
    </bean> 
    <bean id="dpHibernateDeserializer" class="org.dphibernate.serialization.HibernateDeserializer" 
      scope="prototype" /> 

我想看看是提供一種更優雅的配置標籤,類似的人性化春天其他地方使用標籤:

<context:annotation-config /> 
<mvc:annotation-driven /> 
<tx:annotation-driven /> 
<flex:message-broker/> 

等,

不過,我真的不知道從哪裏開始。

這種方法是如何工作的?這些標籤叫什麼?他們的基礎班是什麼?

如果有人能指出我在源代碼中的類名(最好是<flex:message-broker />,因爲這是對我的項目最接近的問題),那麼我可以從那裏開始。我只是不知道從哪裏開始!

回答

2

自定義XML名稱空間當然是可能的(see Appendix D),但在我的經驗中,一個皇家的痛苦才能正常工作。

我強烈建議您改用@Bean-style configuration。這使您可以使用Java來編寫您的bean圖表,而不是XML。它不僅在某些情況下可以更加簡潔,而且適合類型安全,並且更容易重新使用。

無論哪種方式,您最終都會編寫一些將對象連接在一起的Java。這是你如何公開這一點的問題。

+0

謝謝你。由於這是其他人使用的框架,因此我應該研究這兩種方法。 –