spring配置mybatis自动扫描*和*配置文件

时间:2025-03-18 08:40:44
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="/schema/beans" xmlns:xsi="http:///2001/XMLSchema-instance" xmlns:aop="/schema/aop" xmlns:tx="/schema/tx" xmlns:jdbc="/schema/jdbc" xmlns:context="/schema/context" xsi:schemaLocation=" /schema/context /schema/context/spring-context-4. /schema/beans /schema/beans/spring-beans-4. /schema/jdbc /schema/jdbc/spring-jdbc-4. /schema/tx /schema/tx/spring-tx-4. /schema/aop /schema/aop/spring-aop-4."> <!-- myBatis文件 --> <bean class=""> <property name="dataSource" ref="dataSource" /> <!-- 自动扫描entity目录, 省掉里的手工配置 --> <property name="mapperLocations" value="classpath*:com/gbanker/golddashi/**/mapper/*.xml" />
                <!-- 配置实体映射别名在*.xml中直接使用类名即可 -->
<property name="typeAliasesPackage" value=".**.po" /><property name="configLocation" value="classpath:config/"></property></bean><!-- 扫包 --><bean class="">
 <property name="basePackage" value=".**.dao" /><property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" /></bean></beans>


大家如果觉得有哪里不对欢迎指出,谢谢。/y534560449