盛年不重来,一日难再晨,及时当勉励,岁月不待人。这篇文章主要讲述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>
推荐阅读
- Android基础TOP6_1:FrameLyayout和ImageView制作层叠图片
- 为android编译libsocket的脚本
- Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins问题的解决
- PCIE_DMA实例二(xapp1052的EDK仿真)
- AndroidStudio升级后出现Refresh gradle project和connection timed out的原因和解决方法
- 10款最佳人工智能软件(最新人工智能软件评测)
- 数据挖掘 Vs 机器学习 Vs 人工智能 Vs 深度学习(它们有什么区别())
- 机器学习的类型有哪些(监督学习与无监督学习)
- C++ 与 Java比较(C++ 与 Java 之间的30大差异(附示例))