Terracotta+Spring

Terracotta3.1.0版本对Spring的支持发生变化
1.不再支持Spring内嵌标签。而象pojo类一样进行配置。
2.不再支持针对spring事件的分布式监听
比如下面的类:
public class MyClass {

   @autowired                       // This class is to be injected by Spring.
   private MyInstance myInstance;  // myInstance contains application state that 
                                  // must be clustered.
	
}

/*****/

public class MyInstance {

   // X, Y, and Z represent the state that should be clustered.	
	
   private X x;
   private Y y;
   private Z z;
   
	
}

如果要将myInstance属性共享,那么3.1.0之前的配置:
...
<application>
...
  <spring>
    <jee-application>
    ...
      <application-contexts>
        <application-context>
          <paths>
            <path>*/App_context.xml</path>
          </paths>
          <beans>
            <bean name="myBean">
            ...
            </bean>
          </beans>
       </application-context>
     </application-contexts>
    ...
    </jee-application>
  </spring>
...
</application>

现在支持的配置:
<!-- tc:config/application/dso -->
<instrumented-classes>
  <include>
    <class-expression>myPackage.X</class-expression>
    <class-expression>myPackage.Y</class-expression>
    <class-expression>myPackage.Z</class-expression>
  </include>
</instrumented-classes>
<roots>
  <root>
    <field-name>myPackage.MyClass.myInstance</field-name>
<!-- The root name is optional but can help debug. -->
    <root-name>myBean</root-name>  
  </root>
</roots>



附:Spring Bean的相关配置在TC下有二种情况
1.将某个bean的实例共享。
2.将某个bean实例的属性(全部或局部共享,全部如上例配置,局部需要使用transient配合定制)

你可能感兴趣的:(spring,xml,bean)