mis98zb

BlogJava 首页 新随笔 联系 聚合 管理
  7 Posts :: 0 Stories :: 5 Comments :: 0 Trackbacks
呵呵,用上spring2.0了,但是辛辛苦苦研究出来的1.2.x的配置方法也不忍心就这么扔了,放这里做个记录吧。
首先是基于Java5 Annotation的配置:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    
<import
        
resource="classpath:cn/com/nec/esmpro/gserver/util/database/database.beans.xml" />

    
<bean
        
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
        
<description>Switch AOP function ON!</description>
    
</bean>

    
<bean
        
class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
        
<constructor-arg>
            
<bean class="org.springframework.transaction.interceptor.TransactionInterceptor">
                
<property name="transactionManager">
                    
<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                        
<property name="sessionFactory" ref="gserverSessionFactoryBean" />
                    
</bean>
                
</property>
                
<property name="transactionAttributeSource">
                    
<bean class="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource"/>
                
</property>
            
</bean>
        
</constructor-arg>
    
</bean>
</beans>
然后是只使用XML的配置:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    
<import
        
resource="classpath:cn/com/nec/esmpro/gserver/util/database/database.beans.xml" />

    
<bean
        
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
        
<description>Switch AOP function ON!</description>
    
</bean>

    
<bean
        
class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
        
<property name="classFilter">
            
<bean class="???????????????????????????????????????">
            
</bean>
        
</property>
        
<property name="transactionInterceptor">
            
<bean class="org.springframework.transaction.interceptor.TransactionInterceptor">
                
<property name="transactionManager">
                    
<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                        
<property name="sessionFactory" ref="gserverSessionFactoryBean" />
                    
</bean>
                
</property>
                
<property name="transactionAttributes">
                    
<props>
                        
<prop key="*">PROPAGATION_REQUIRED</prop>
                        
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
                    
</props>
            
</property>
            
</bean>
        
</property>
    
</bean>
</beans>

posted on 2006-08-22 14:47 mis98zb 阅读(520) 评论(0)  编辑  收藏 所属分类: java

只有注册用户登录后才能发表评论。


网站导航: