applicationContext.xml

盛年不重来,一日难再晨,及时当勉励,岁月不待人。这篇文章主要讲述applicationContext.xml相关的知识,希望能为你提供帮助。
< ?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: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"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">
< !-- 扫描注解类 -->
< context:component-scan base-package="cn.bdqn.oa.service"> < /context:component-scan>

< !-- 数据源 -->
< bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
< property name="url" value="https://www.songbingjia.com/android/jdbc:oracle:thin:@localhost:1521:orcl"> < /property>
< property name="username" value="https://www.songbingjia.com/android/user_a"> < /property>
< property name="password" value="https://www.songbingjia.com/android/abc123"> < /property>
< property name="driverClassName" value="https://www.songbingjia.com/android/oracle.jdbc.driver.OracleDriver"> < /property>
< /bean>
【applicationContext.xml】< !-- 事务管理器 -->
< bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
< property name="dataSource" ref="dataSource"> < /property>
< /bean>
< tx:annotation-driven transaction-manager="txManager"/>

< !-- sqlsessionFactory -->
< bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
< property name="dataSource" ref="dataSource"> < /property>
< property name="typeAliasesPackage" value="https://www.songbingjia.com/android/cn.bdqn.oa.entity"/>
< /bean>
< !-- 扫描所有的mybatis接口成对象 -->
< bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
< property name="sqlSessionFactory" ref="sqlSessionFactory"> < /property>
< property name="basePackage" value="https://www.songbingjia.com/android/cn.bdqn.oa.mapper"> < /property>
< /bean>

< /beans>
































    推荐阅读