- Spring+JDBC组合开发配置数据源有两种方式:
- 1.基于XML
- 2.基于注解
- 首先我们看看基于XML的配置:
- 步骤:
- 1.首先导入我们数据源依赖的jar包,如下图
- 2.写beans.xml配置文件,配置事务时,需要在xml配置文件中引入用于声明事务的tx命名空间
- 比以前的配置文件多了
- xmlns:tx="http://www.springframework.org/schema/tx"
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- Java代码
- <?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:aop="http://www.springframework.org/schema/aop"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
Spring+JDBC组合开发配置数据源有两种方式:
精选 转载文章标签 职场 休闲 Spring+JDBC组合开发配置数据源 文章分类 Java 后端开发
上一篇:工作流基本知识
-
Vue使用两种方式打印页面数据
Vue使用两种方式打印页面数据
html JSON 数据 打印 Vue -
Spring+JDBC组合开发及环境搭建
知识点;【 使用属性占位符
spring bc Source -
druid 对于数据源加密的两种方式WEB开发 加密结果 数据源 用户名
















