|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <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:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
- http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
-
- <aop:config proxy-target-class="true"/>
- <context:annotation-config/>
- <context:component-scan base-package="com.sie.demo.comm.model.dao,com.sie.demo.comm.model.inter.server,cn.hutool.extra.spring"/>
-
- <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <list>
- <value>classpath:com/sie/demo/comm/config/db_jdbc.properties</value>
- </list>
- </property>
- </bean>
-
- <bean id="dataSource" destroy-method="close" class="com.sie.iot.common.dbcp.BasicDataSourceDecrypt">
- <property name="driverClassName" value="${properties.jdbc.driverClassName}"/>
- <property name="url" value="${properties.jdbc.url}"/>
- <property name="username" value="${properties.jdbc.username}"/>
- <property name="password" value="${properties.jdbc.password}"/>
- <property name="validationQuery" value="${properties.jdbc.validationQuery}"/>
- <property name="initialSize" value="${properties.jdbc.initialSize}"/>
- <property name="maxActive" value="${properties.jdbc.maxActive}"/>
- <property name="maxIdle" value="${properties.jdbc.maxIdle}"/>
- <property name="minIdle" value="${properties.jdbc.minIdle}"/>
- </bean>
-
- <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
- <property name="dataSource" ref="dataSource"/>
- <property name="packagesToScan">
- <list>
- <value>com.sie.demo.comm.model.entities</value>
- </list>
- </property>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
- <prop key="hibernate.show_sql">true</prop>
- <!--<prop key="hibernate.hbm2ddl.auto">update</prop>-->
- <prop key="javax.persistence.validation.mode">none</prop>
- </props>
- </property>
- </bean>
-
- <bean id="hibernateTemplete" class="org.springframework.orm.hibernate5.HibernateTemplate">
- <property name="sessionFactory" ref="sessionFactory"></property>
- </bean>
- <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactory"></property>
- </bean>
- <!-- 配置事务的传播特性 -->
- <tx:advice id="txAdvice" transaction-manager="transactionManager">
- <tx:attributes>
- <tx:method name="insert*" propagation="REQUIRED" rollback-for="Exception" read-only="false"/>
- <tx:method name="save*" propagation="REQUIRED" rollback-for="Exception" read-only="false"/>
- <tx:method name="update*" propagation="REQUIRED" rollback-for="Exception" read-only="false"/>
- <tx:method name="delete*" propagation="REQUIRED" rollback-for="Exception" read-only="false"/>
- <tx:method name="find*" read-only="true"/>
- </tx:attributes>
- </tx:advice>
- <!-- 那些类的哪些方法参与事务 -->
- <aop:config><!--|| execution(* com.sie.saaf.*.model.dao.readonly.*.*(..))-->
- <aop:pointcut id="businessService" expression="execution(* com.sie.demo.comm.model.inter.server.*.*(..))
- || execution(* com.sie.iot.common.model.inter.server.*.*(..))
- || execution(* com.sie.iot.file.model.inter.server.*.*(..))"/>
- <aop:advisor advice-ref="txAdvice" pointcut-ref="businessService" order="0"/>
- </aop:config>
-
-
-
-
- <bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
- <property name="hostName" value="${spring.redis.host}"></property>
- <property name="port" value="${spring.redis.port}"/>
- <property name="password" value="${spring.redis.password}"></property>
- </bean>
- <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
- <property name="connectionFactory" ref="redisConnectionFactory"></property>
- </bean>
-
-
-
-
-
- </beans>
|