jpa

来源:互联网 发布:mac系统怎么看文件大小 编辑:程序博客网 时间:2024/06/05 16:12
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" 
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" 
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans    
           http://www.springframework.org/schema/beans/spring-beans.xsd   
           http://www.springframework.org/schema/tx     
           http://www.springframework.org/schema/tx/spring-tx.xsd    
           http://www.springframework.org/schema/context   
           http://www.springframework.org/schema/context/spring-context.xsd
           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd   
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"
default-autowire="byName" default-lazy-init="true">


<!-- ========================= RESOURCE DEFINITIONS ========================= -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="fileEncoding" value="UTF-8" />
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:ldap.properties</value>
</list>
</property>
</bean>


    <bean id="dbConnection" depends-on="propertyConfigurer"
        class="com.forgon.tools.db.InitDbConnection">
        <property name="driverClass"
            value="${jdbc.driverClassName}" />
        <property name="jdbcUrl" value="${jdbc.url}" />
        <property name="database" value="${database}" />
    </bean>


<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">    
   <property name="jndiName">  
    <value>jiyou_ds_jndi</value>  
   </property>  
    </bean>
    
<bean id="dataSourceProperties" class="com.forgon.tools.hibernate.PropertiesEncryptFactoryBean">   
        <property name="properties">
            <props>
                <prop key="user">${jdbc.username}</prop>
                <prop key="password">${jdbc.password}</prop>
            </props>
        </property>
    </bean>
    
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" 
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingLocations">
<list>
<value>classpath*:/*.hbm.xml</value>
</list>
</property>
<property name="annotatedClasses">
<list>
<value>com.class</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.generate_statistics">true</prop>
                <prop key="hibernate.connection.release_mode">auto</prop>
                <prop key="hibernate.autoReconnect">true</prop>
                <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="current_session_context_class">thread</prop>
</props>
</property>
<property name="eventListeners">
<map>
<entry key="merge">
<bean
class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />
</entry>
</map>
</property>
</bean>


<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
</bean>


<bean id="springUtilInitializer"
class="com.forgon.tools.SpringBeanManger" lazy-init="false" />



<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>


<!-- 支持 @Transactional 标记 -->
<tx:annotation-driven/>

<context:component-scan base-package="com.chinapost,com.forgon">
</context:component-scan>

<!-- 支持 @AspectJ 标记-->
<aop:aspectj-autoproxy/>


<!-- 以AspectJ方式 定义 AOP -->
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* org.springside.security..*Manager.*(..))" advice-ref="txAdvice"/>
<aop:advisor pointcut="execution(* org.springside.core.dao..*Dao.*(..))" advice-ref="txAdvice"/>
<aop:advisor pointcut="execution(* com.chinapost.tran.service.impl.TranServiceImpl.handlerAccessoryProducts(..))" advice-ref="txAdvice"/>
<aop:advisor pointcut="execution(* com.chinapost.jyActivity.utils.DataUtil.calueData(..))" advice-ref="txAdvice"/>
</aop:config>


<!-- 基本事务定义,使用transactionManager作事务管理,默认get*方法的事务为readonly,其余方法按默认设置.
默认的设置请参考Spring文档事务一章. -->
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="find*" read-only="true"/>
<tx:method name="*"/>
</tx:attributes>
</tx:advice>


<bean id="domainObjectAclAspect" class="com.forgon.aspect.platform.DomainObjectAclAspect">
</bean>

<bean id="hardWareUtils" class="com.forgon.tools.hardware.HardWareUtils" />

<!-- 文件上传 -->
<bean id="multipartResolver"
       class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <!-- set the max upload size100MB -->
        <property name="maxUploadSize">
       <value>104857600</value>
   </property>
   </bean>
   
   <!-- 
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>classpath:resources/oa</value>
</list>
</property>
</bean>
-->
</beans>
0 0
原创粉丝点击