spring.mybatis.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wichell-common Show documentation
Show all versions of wichell-common Show documentation
common project com.wichell.wichell jar
The newest version!
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd"> <bean id="sqlSessionFactory" class="com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean"> <description>spring和MyBatis完美整合,不需要mybatis的配置映射文件</description> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="classpath:mybatis-config.xml" /> <!-- 自动扫描mapping.xml文件 --> <property name="mapperLocations" value="classpath*:**/mapper/xml/*.xml" /> <property name="typeAliasesPackage" value="com.wichell.model*" /> <property name="globalConfig"> <bean class="com.baomidou.mybatisplus.entity.GlobalConfiguration"> <property name="dbColumnUnderline" value="true" /> <property name="sqlInjector"> <bean class="com.baomidou.mybatisplus.mapper.AutoSqlInjector" /> </property> </bean> </property> </bean> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <description>DAO接口所在包名,Spring会自动查找其下的类</description> <property name="basePackage" value="com.wichell.mapper*" /> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" /> </bean> <!-- 事务 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /> </beans>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy