WebRoot/WEB-INF/classes/resource/applicationContext.xml
(完整代码) 2KB<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mybatis="http://mybatis.org/schema/mybatis-spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
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/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://mybatis.org/schema/mybatis-spring
http://mybatis.org/schema/mybatis-spring.xsd ">
<!-- MyBatis自动扫描mapper -->
<mybatis:scan base-package="com.shop.dao" />
<!-- Spring自动扫包 -->
<context:component-scan base-package="com.shop.*" />
<!-- 引入数据库资源文件 -->
<context:property-override location="classpath:resource/db.properties" />
<!-- 使用C3P0管理数据连接 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"></bean>
<!-- 声明MyBatis的SqlSessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:resource/mybatis-config.xml" />
<property name="mapperLocations" value="classpath:com/shop/**/**.xml">
</property>
</bean>
<!-- 配置事务管理器 -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
p:dataSource-ref="dataSource" />
<!-- 开启事务的注解配置 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。