applicationContext-persist.xml 3.2 KB
Newer Older
MaxKey单点登录官方's avatar
MaxKey单点登录官方 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
<?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:p="http://www.springframework.org/schema/p"
  xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
  xmlns:cache="http://www.springframework.org/schema/cache"
  xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/cache
        http://www.springframework.org/schema/cache/spring-cache-3.2.xsd">


  <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <property name="dataSource" ref="dataSource" />
  </bean>

  <tx:annotation-driven transaction-manager="txManager" />

  <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
  </bean>

MaxKey单点登录官方's avatar
log4j2  
MaxKey单点登录官方 已提交
29 30
    <!-- enable autowire 
    <context:annotation-config />-->
MaxKey单点登录官方's avatar
MaxKey单点登录官方 已提交
31 32 33 34 35 36 37

    <!-- enable transaction demarcation with annotations 
    <tx:annotation-driven />-->

	<!--<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">-->
	<bean id="sqlSessionFactory" class="org.apache.mybatis.jpa.MyBatisSessionFactoryBean">
		<property name="timeout" value="30" />
M
Highgo  
MaxKey 已提交
38
		<property name="dialect" value="postgresql" />
MaxKey单点登录官方's avatar
MaxKey单点登录官方 已提交
39
		<property name="dataSource" ref="dataSource" />
M
Highgo  
MaxKey 已提交
40
		<property name="mapperLocations" value="classpath*:/org/apache/mybatis/jpa/test/dao/persistence/xml/postgresql/*.xml" />
MaxKey单点登录官方's avatar
MaxKey单点登录官方 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
		<property name="typeAliasesPackage" 
        		  value="
	        			org.apache.mybatis.jpa.test.domain,
        			" />
		<property name="transactionFactory">
			<bean class="org.apache.ibatis.transaction.managed.ManagedTransactionFactory" />
		</property>
	</bean>

    <!-- scan for mappers and let them be autowired -->
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" 
        		  value="
        		  		org.apache.mybatis.jpa.test.dao.persistence,
        		  		" />
      
    </bean>

 	<!-- enable component scanning (beware that this does not enable mapper scanning!) -->    
    <context:component-scan base-package="org.apache.mybatis.jpa.test.dao.service" />
    
    <bean class ="org.apache.mybatis.jpa.id.IdentifierGeneratorFactory">
	    <property name="generatorStrategyMap" >
	    	<map>
		        <entry key="serial" >
		        	<bean class="org.apache.mybatis.jpa.id.SerialGenerator">
		        		<property name="ipAddressNodeValue"  value="F0-76-1C-B0-26-9C=02,"/>
		        	</bean></entry>
		    </map>
	    </property>
    </bean>
    
   	<!-- 
	<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
		<constructor-arg index="0" ref="sqlSessionFactory" />
	</bean>
	 -->
</beans>