Java 中的 applicationContext-dao.xml 文件 内容

Java 中的 applicationContext-dao.xml 文件 内容

此文件会随着时间不断更新

<?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:aop="http://www.springframework.org/schema/aop"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop.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/mvc
       http://www.springframework.org/schema/mvc/spring-mvc.xsd ">

	<!-- 配置注解扫描 pojo -->
	<context:component-scan
		base-package="com.YKenan.YKenan.pojo"></context:component-scan>

	<!-- 加载数据库配置文件和其他配置文件 -->
	<context:property-placeholder location="classpath:db.properties" />
	
	<!-- 数据库连接池 -->
	<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
		<property name="driverClassName" value="${jdbc.driver}"></property>
		<property name="url" value="${jdbc.url}"></property>
		<property name="username" value="${jdbc.username}"></property>
		<property name="password" value="${jdbc.password}"></property>
		<!-- 最大连接数据库连接数,设为 0 为没有限制 -->
		<property name="maxActive" value="10"></property>
		<!-- 最小链接池数量 -->
		<property name="minIdle" value="5"></property>
	</bean>
	
	<!-- 整合 mybatis: SqlSessionFactory -->
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<!-- 数据源 -->
		<property name="dataSource" ref="dataSource"></property>
		<!-- mybatis 配置文件 -->
		<property name="configLocation" value="classpath:mybatis/mybatis-config.xml"></property>
	</bean>
	
	<!-- 注入 DAO 对象:配置 mapper MapperFactoryBean:用于生成 mapper 代理对象 -->
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<!-- 配置扫描包的路径,如果要扫描多个包,中间使用半角逗号分隔 -->
		<property name="basePackage" value="com.YKenan.YKenan.mapper"></property>
		<!-- 使用 sqlSessionFactoryBean -->
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
	</bean>
	

</beans>

猜你喜欢

转载自blog.csdn.net/YKenan/article/details/88738881