Spring基础知识总结(四):JdbcTemplate

Spring详解之jdbcTemplate Spring框架对JDBC进行封装,使用jdbcTemplate方便实现对数据库操作。 阅读详情

一: Spring 中的 JdbcTemplate[会用]

1.1JdbcTemplate 概述

它是 spring 框架中提供的一个对象,是对原始 Jdbc API 对象的简单封装。 spring 框架为我们提供了很多的操作模板类。

  • 操作关系型数据的: 1. JdbcTemplate 2. HibernateTemplate
  • 操作 nosql 数据库的: RedisTemplate
  • 操作消息队列的: JmsTemplate

我们今天的主角在 spring-jdbc-5.0.2.RELEASE.jar 中,我们在导包的时候,除了要导入这个 jar 包外,还需要导入一个 spring-tx-5.0.2.RELEASE.jar(它是和事务相关的)

1.2JdbcTemplate 对象的创建

我们可以参考它的源码,来一探究竟:

public JdbcTemplate() {
}
public JdbcTemplate(DataSource dataSource) {
	setDataSource(dataSource);
	afterPropertiesSet();
}
public JdbcTemplate(DataSource dataSource, boolean lazyInit) {
	setDataSource(dataSource);
	setLazyInit(lazyInit);
	afterPropertiesSet();
}

除了默认构造函数之外,都需要提供一个数据源。既然有set方法,依据我们之前学过的依赖注入,我们可以在配置文件中配置这些对象。

1.3spring 中配置数据源

1.3.1 环境搭建

在这里插入图片描述

1.3.2 编写 spring 的配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">

</beans>

1.3.3 配置数据源

我们之前已经接触过了两个数据源, C3P0 和 DBCP。要想使用这两数据源都需要导入对应的 jar 包。

1.3.3.1 配置 C3P0 数据源

导入c3p0-0.9.2.1.jar 到工程的lab目录中,在 spring 的配置文件中配置:

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
	<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
	<property name="jdbcUrl" value="jdbc:mysql:///spring_day02"></property>
	<property name="user" value="root"></property>
	<property name="password" value="1234"></property>
</bean>
1.3.3.2 配置 DBCP 数据源

导入在这里插入图片描述 到工程的 lib 目录。在 spring 的配置文件中配置

<!-- 配置数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
	<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
	<property name="url" value="jdbc:mysql:// /spring_day02"></property>
	<property name="username" value="root"></property>
	<property name="password" value="1234"></property>
</bean>
1.3.3.3 配置 spring 内置数据源

spring 框 架 也 提 供 了 一 个 内 置 数 据 源 , 我 们 也 可 以 使 用 spring 的 内 置 数 据 源 , 它 就 在spring-jdbc-5.0.2.REEASE.jar 包中:

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
	<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
	<property name="url" value="jdbc:mysql:///spring_day02"></property>
	<property name="username" value="root"></property>
	<property name="password" value="1234"></property>
</bean>

1.3.4 将数据库连接的信息配置到属性文件中:

【定义属性文件】

jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql:///spring_day02
jdbc.username=root
jdbc.password=123

【引入外部的属性文件】
一种方式:

<!-- 引入外部属性文件: -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:jdbc.properties"/>
</bean>

另一种方式:

<context:property-placeholder location="classpath:jdbc.properties"/>

1.4JdbcTemplate 的增删改查操作

创建数据库:

create database spring_day02;
use spring_day02;

创建表:

create table account(
id int primary key auto_increment,
name varchar(40),
money float
)character set utf8 collate utf8_general_ci;

1.4.2 在 spring 配置文件中配置 JdbcTemplate

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans.xsd">
	
	<!-- 配置一个数据库的操作模板: JdbcTemplate -->
	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
		<property name="dataSource" ref="dataSource"></property>
	</bean>
	<!-- 配置数据源 -->
	<bean id="dataSource"class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
		<property name="url" value="jdbc:mysql:///spring_day02"></property>
		<property name="username" value="root"></property>
		<property name="password" value="1234"></property>
	</bean>
</beans>

1.4.3 最基本使用

public class JdbcTemplateDemo2 {
	public static void main(String[] args) {
		//1.获取 Spring 容器
		ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
		//2.根据 id 获取 bean 对象
		JdbcTemplate jt = (JdbcTemplate) ac.getBean("jdbcTemplate");
		//3.执行操作
		jt.execute("insert into account(name,money)values('eee',500)");
	}
}

1.4.4 保存操作

public class JdbcTemplateDemo3 {
	public static void main(String[] args) {
			//1.获取 Spring 容器
			ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
			//2.根据 id 获取 bean 对象
			JdbcTemplate jt = (JdbcTemplate) ac.getBean("jdbcTemplate");
			//3.执行操作
			//保存
			jt.update("insert into account(name,money)values(?,?)","fff",5000);
		}
}

1.4.5 更新操作

public class JdbcTemplateDemo3 {
	public static void main(String[] args) {
		//1.获取 Spring 容器
		ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
		//2.根据 id 获取 bean 对象
		JdbcTemplate jt = (JdbcTemplate) ac.getBean("jdbcTemplate");
		//3.执行操作
		//修改
		jt.update("update account set money = money-? where id = ?",300,6);
	}
}

1.4.6 删除操作

public class JdbcTemplateDemo3 {
	public static void main(String[] args) {
		//1.获取 Spring 容器
		ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
		//2.根据 id 获取 bean 对象
		JdbcTemplate jt = (JdbcTemplate) ac.getBean("jdbcTemplate");
		//3.执行操作
		//删除
		jt.update("delete from account where id = ?",6);
	}
}

1.4.7 查询所有操作

public class JdbcTemplateDemo3 {
	public static void main(String[] args) {
			//1.获取 Spring 容器
			ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
			//2.根据 id 获取 bean 对象
			JdbcTemplate jt = (JdbcTemplate) ac.getBean("jdbcTemplate");
			//3.执行操作
			//查询所有
			List<Account> accounts = jt.query("select * from account where money > ? ",
			new AccountRowMapper(), 500);
			for(Account o : accounts){
			System.out.println(o);
		}
	}
}
public class AccountRowMapper implements RowMapper<Account>{
	@Override
	public Account mapRow(ResultSet rs, int rowNum) throws SQLException {
		Account account = new Account();
		account.setId(rs.getInt("id"));
		account.setName(rs.getString("name"));
		account.setMoney(rs.getFloat("money"));
		return account;
	}
}

1.4.8 查询一个操作

使用 RowMapper 的方式:常用的方式

public class JdbcTemplateDemo3 {
	public static void main(String[] args) {
		//1.获取 Spring 容器
		ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
		//2.根据 id 获取 bean 对象
		JdbcTemplate jt = (JdbcTemplate) ac.getBean("jdbcTemplate");
		//3.执行操作
		//查询一个
		List<Account> as = jt.query("select * from account where id = ? ",
		new AccountRowMapper(), 55);
		System.out.println(as.isEmpty()?"没有结果":as.get(0));
	}
}

使用 ResultSetExtractor 的方式:不常用的方式

public class JdbcTemplateDemo3 {
	public static void main(String[] args) {
		//1.获取 Spring 容器
		ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
		//2.根据 id 获取 bean 对象
		JdbcTemplate jt = (JdbcTemplate) ac.getBean("jdbcTemplate");
		//3.执行操作
		//查询一个
		Account account = jt.query("select * from account where id = ?",
		new AccountResultSetExtractor(),3);
		System.out.println(account);
	}
}

1.4.9 查询返回一行一列操作

public class JdbcTemplateDemo3 {
	public static void main(String[] args) {
		//1.获取 Spring 容器
		ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
		//2.根据 id 获取 bean 对象
		JdbcTemplate jt = (JdbcTemplate) ac.getBean("jdbcTemplate");
		//3.执行操作
		//查询返回一行一列:使用聚合函数,在不使用 group by 字句时,都是返回一行一列。最长用的
		就是分页中获取总记录条数
		Integer total = jt.queryForObject("select count(*) from account where money > ?
		",Integer.class,500);
		System.out.println(total);
	}
}

1.5在 dao 中使用 JdbcTemplate

1.5.1 准备实体类

/**
* 账户的实体
*/
public class Account implements Serializable {
private Integer id;
private String name;
private Float money;
//getter setter

1.5.2 第一种方式:在 dao 中定义 JdbcTemplate

/**
* 账户的接口
*/
public interface IAccountDao {
	/**
	* 根据 id 查询账户信息
	* @param id
	* @return
	*/
	Account findAccountById(Integer id);
	/**
	* 根据名称查询账户信息
	* @return
	*/
	Account findAccountByName(String name);
	/**
	* 更新账户信息
	* @param account
	*/
	void updateAccount(Account account);
}
/**
* 账户的持久层实现类
* 此版本的 dao,需要给 dao 注入 JdbcTemplate
*/
public class AccountDaoImpl implements IAccountDao {

	private JdbcTemplate jdbcTemplate;
	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}
	
	@Override
	public Account findAccountById(Integer id) {
		List<Account> list = jdbcTemplate.query("select * from account where id = ?
		",new AccountRowMapper(),id);
		return list.isEmpty()?null:list.get(0);
	}
	
	@Override
	public Account findAccountByName(String name) {
		List<Account> list = jdbcTemplate.query("select * from account where name
		= ? ",new AccountRowMapper(),name);
		
		if(list.isEmpty()){
			return null;
		}
		if(list.size()>1){
			throw new RuntimeException("结果集不唯一,不是只有一个账户对象");
		}
		return list.get(0);
	}
	
	@Override
	public void updateAccount(Account account) {
		jdbcTemplate.update("update account set money = ? where id = ?
		",account.getMoney(),account.getId());
	}
}

配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
	
	<!-- 配置一个 dao -->
	<bean id="accountDao" class="com.itheima.dao.impl.AccountDaoImpl">
		<!-- 注入 jdbcTemplate -->
		<property name="jdbcTemplate" ref="jdbcTemplate"></property>
	</bean>
	<!-- 配置一个数据库的操作模板: JdbcTemplate -->
	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
		<property name="dataSource" ref="dataSource"></property>
	</bean>
	
	<!-- 配置数据源 -->
	<bean id="dataSource"class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
		<property name="url" value="jdbc:mysql:///spring_day04"></property>
		<property name="username" value="root"></property>
		<property name="password" value="1234"></property>
	</bean>
</beans>

配置完上述代码后,我门发现每个dao都有下面的一段重复代码

	private JdbcTemplate jdbcTemplate;
	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}

1.5.3 第二种方式:让 dao 继承 JdbcDaoSupport

JdbcDaoSupport 是 spring 框架为我们提供的一个类,该类中定义了一个 JdbcTemplate 对象,我们可以直接获取使用,但是要想创建该对象,需要为其提供一个数据源:具体源码如下:

public abstract class JdbcDaoSupport extends DaoSupport{
	//定义对象
	private JdbcTemplate jdbcTemplate;
	
	//set 方法注入数据源,判断是否注入了,注入了就创建 JdbcTemplate
	public final void setDataSource(DataSource dataSource) {
		if (this.jdbcTemplate == null || dataSource != this.jdbcTemplate.getDataSource()){
			//如果提供了数据源就创建 JdbcTemplate
			this.jdbcTemplate = createJdbcTemplate(dataSource);
			initTemplateConfig();
		}
	}
	//使用数据源创建 JdcbTemplate
	protected JdbcTemplate createJdbcTemplate(DataSource dataSource) {
		return new JdbcTemplate(dataSource);
	}
	//当然,我们也可以通过注入 JdbcTemplate 对象
	public final void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
		initTemplateConfig();
	}
	//使用 getJdbcTmeplate 方法获取操作模板对象
	public final JdbcTemplate getJdbcTemplate() {
		return this.jdbcTemplate;
	}
}
/**
* 账户的接口
*/
public interface IAccountDao {
	/**
	* 根据 id 查询账户信息
	* @param id
	* @return
	*/
	Account findAccountById(Integer id);
	/**
	* 根据名称查询账户信息
	* @return
	*/
	Account findAccountByName(String name);
	/**
	* 更新账户信息
	* @param account
	*/
	void updateAccount(Account account);
}
/**
 * 账户的持久层实现类
 * 此版本 dao,只需要给它的父类注入一个数据源
*/
public class AccountDaoImpl2 extends JdbcDaoSupport implements IAccountDao {
	@Override
	public Account findAccountById(Integer id) {
		//getJdbcTemplate()方法是从父类上继承下来的。
		List<Account> list = getJdbcTemplate().query("select * from account where id = ? ",new AccountRowMapper(),id);
		return list.isEmpty()?null:list.get(0);
	}
	
	@Override
	public Account findAccountByName(String name) {
		//getJdbcTemplate()方法是从父类上继承下来的。
		List<Account> list = getJdbcTemplate().query("select * from account where name = ? ",new AccountRowMapper(),name);
		if(list.isEmpty()){
			return null;
		}
		if(list.size()>1){
			throw new RuntimeException("结果集不唯一,不是只有一个账户对象");
		}
		return list.get(0);
	}
	
	@Override
	public void updateAccount(Account account) {
		//getJdbcTemplate()方法是从父类上继承下来的。
		getJdbcTemplate().update("update account set money = ? where id = ? ",account.getMoney(),account.getId());
	}
}

配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
	<!-- 配置 dao2 -->
	<bean id="accountDao2" class="com.itheima.dao.impl.AccountDaoImpl2">
		<!-- 注入 dataSource -->
		<property name="dataSource" ref="dataSource"></property>
	</bean>
	
	<!-- 配置数据源 -->
	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
		<property name="url" value="jdbc:mysql:///spring_day04"></property>
		<property name="username" value="root"></property>
		<property name="password" value="1234"></property>
	</bean>
</beans>

两版 Dao 的区别

  • 第一种在 Dao 类中定义 JdbcTemplate 的方式,适用于所有配置方式( xml 和注解都可以)。
  • 第二种让 Dao 继承 JdbcDaoSupport 的方式,只能用于基于 XML 的方式,注解用不了。
Spring JdbcTemplate基本使用 Spring JdbcTemplate基本使用 文章目录Spring JdbcTemplate基本使用1.JdbcTemplate概述2. JdbcTemplate开发步骤3.快速入门4. Spring产生JdbcTemplate对象 1.JdbcTemplate概述 它是spring框架中提供的一个对象,是对原始繁琐的Jdbc API对象的简单封装。spring框架为我们提供了很多的操作模板类。例如:操作关系型数据的JdbcTemplate和HibernateTemplate,操作nosql数据库的Red 阅读详情

相关推荐

Spring:JDBCTemplate

Spring JDBCTemplate介绍

啊Q老师 6880

Spring-JdbcTemplate

JdbcTemplate作用:用于和数据库交互的,实现对表的CRUD操作 原始操作: public class JdbcTemplateDemo1 { public static void main(String[] args) { //Spring的内置数据源 DriverManagerDataSource ds = new DriverManagerD...

Oliver_z的博客 635

Spring Boot:使用JdbcTemplate

JdbcTemplate相较于MyBaits,Hibernate等数据库框架更容易上手,对SQL的操作也更为直观方便,所以在项目中也是一个不错的选择。在Spring Boot开启JdbcTemplate很简单,只需要引入依赖即可。JdbcTemplate封装了许多SQL操作,具体可查阅官方文档。

新华编程特战队 1553

【Spring六】JDBC编程之XML配置

jdbc编程最主要的就是要引入数据源,常见的有dbcp数据源,c3p0数据源等。 几个重要的类: JdbcTemplate,里面提供了dao的方法,需要提供数据源给他! JdbcDaoSupport RowMapper 说明:    无论采用什么样的方法必须把dataSource注入到JdbcTemplate里   1、继承JdbcDaoSupport(该类有Jdbc

温故而知新 1160

spring JDBC

springjdbc 详细步骤 教你配置

BurpSuit在不同浏览器中配置代理

文章通过分享各大浏览器如何设置代理的知识,帮助初学者快速掌握代理配置相关技能。

北冥同学的成长记录笔记 1万+

6.Spring中使用JdbcTemplate操作数据库(DataSource配置、XML配置、继承JdbcDaoSupport)

类,这个类中定义了JdbcTemplate属性,也定义了DataSource属性,当设置DataSource属性的时候,会创建jdbcTemplate的实例,所以自己编写的DAO只需要继承JdbcDaoSupport类,然后注入DataSource即可。也就是它是从外部“注入”DataSource到DAO中,然后自己实例化JdbcTemplate,然后将DataSource设置到JdbcTemplate对象中。jdbcTemplate对于查询来说,如果对sql比较精通,使用起来非常方便,灵活。

相互学习 共同进步 1222

QT+SOEM主站协议库实战指南—从编译到嵌入式应用

本文提供了一份QT与SOEM开源EtherCAT主站协议库的集成实战指南。详细介绍了在Windows和Linux平台下编译SOEM库的步骤,并讲解了如何将其无缝集成到QT项目中,构建具备实时监控与控制功能的工业上位机应用。内容涵盖从环境搭建、核心协议开发到嵌入式部署与优化的全流程,为开发高性价比、自主可控的工业控制解决方案提供完整路径。

u6v7w8x的博客 437

Spring JdbcTemplate 使用及持久层继承JdbcDaoSupport XML配置

Spring jdbcTemplate使用到的spring包 1.最简单用法 (开发时,不常用) /** * JdbcTemplate的最基本用法 */ public class JdbcTemplateDemo1 { public static void main(String[] args) { //准备数据源:spring的内置数据源 ...

多凡的博客 933

别再手动翻译PDF了!手把手教你用Zotero PDF Translate插件搞定外文文献(附最新GitHub下载链接)

本文详细介绍如何利用Zotero PDF Translate插件高效翻译外文文献,包括插件安装、配置及多引擎对比。通过划词翻译、段落翻译和全文翻译功能,显著提升科研工作效率,特别适合处理大量英文PDF文献的研究人员。

weixin_33712987的博客 771

谷歌Gemini模型免费API调用全攻略:从注册到实战(附代码示例)

本文详细介绍了如何免费调用谷歌Gemini模型的API,从注册获取API密钥到实战应用的全过程。内容涵盖环境准备、基础API调用、多模态处理、高级功能及生产环境实践,帮助开发者高效利用Gemini模型进行代码生成和复杂任务处理。附有代码示例,适合AI开发者和技术爱好者。

weixin_29212429的博客 1599

Spring Boot 重写JdbcTemplate类

一、获取容器中的bean(JdbcTemplate) 1.创建SpringUtils通过beanname获取容器中的bean对象 2.编写MyJdbcTemplate类来处理JdbcTemplate的方法返回的数据 3.使用MyJdbcTemplate 以上是第一种方式的过程,获取容器的中的JdbcTemplate的bean,然后再调用bean对象的相关方法,获取返回的数据再加以处理。1.MyJdbcTemplateNew 继承JdbcTemplate类 2.利用@Configuration和@Bean 注

weixin_44525106的博客 1050

基于STM32L4XX 、HAL库的TMP144YFFR数字温度传感器驱动应用C语言程序设计

define TMP144_ADDRESS 0x00 // 默认为全局地址,用于单器件或MDA命令。#define TMP144_CMD_READ_TEMP 0x00 // 读取温度寄存器命令。if (temp_raw & 0x800) { // 判断第11位(符号位)

PP_Cottage的博客 91

Spring —— JdbcTemplate

一、概述 二、对象创建 2.1 需要导入的 jar 包 2.2 创建 JdbcTemplate 对象 2.3 配置 Spring 内置数据源 一、概述 JdbcTemplate 是 Spring 框架中提供的一个对象,是对原始 Jdbc API 对象的简单封装。Spring 框架为我们提供了很多 的操作模板类。 对象创建 2.1 需要导入的 jar 包 <dependencies&...

IF 822

YOLOv11涨点改进| SCI一区2026 |独家创新首发、特征融合改进篇|引入FAFM特征对齐融合模块,通过特征对齐和融合两个阶段,助力多模态融合小目标检测,小目标检测,SAR图像目标检测高效涨点

🔥本文提出了一种改进YOLOv11网络模型的方法,通过引入FAFM(特征对齐融合模块)来解决多模态目标检测中的特征空间错位问题。FAFM模块采用可变形卷积和内容引导注意力机制,有效实现了跨模态特征对齐与融合,充分利用了不同模态间的互补信息。该方法在保持模型轻量化的同时,显著提升了目标检测精度和鲁棒性,特别是在复杂背景和模态差异较大的场景下表现突出。文章详细介绍了FAFM模块的结构、原理、优势,并提供了完整的代码实现和模型配置方案,为多模态目标检测任务提供了实用的技术参考。

Ai缝合怪、助力小伙伴高效发论文 267

动力学约束下的运动规划算法——Kinodynamic RRT*算法

动力学约束下的运动规划算法——Kinodynamic RRT*算法

慕羽★的博客 6747

Spring boot jdbcTemplate

文章目录上一节 Spring boot lombok源码下一节 Spring boot 数据库连接池Spring boot jdbcTemplate 上一节 Spring boot lombok Spring boot lombok 源码 springboot学习指南 下一节 Spring boot 数据库连接池 Spring boot 数据库连接池 Spring boot jdbcTemplate ...

xiao/du的博客 4201

SAP Single Sign-On 全景指南:从传统 SAP SSO 到 SAP Secure Login Service for SAP GUI 的架构、场景与迁移实践

本文系统梳理了SAP生态下的单点登录技术方案,重点分析了SAP GUI的云化替代方案SAP Secure Login Service(SLS)。内容涵盖SNC、Kerberos/SPNEGO、SAML 2.0等核心协议的技术实现,对比了传统SAP SSO与新型SLS for SAP GUI的架构差异,并给出AS ABAP系统的具体实施路径。针对SAP GUI访问、浏览器访问Fiori/移动端等不同场景,提供了详细的协议选型建议和配置指南,帮助团队构建安全可靠且适应云时代的统一认证体系。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 273

Spring JdbcTemplate详解

提供了一个简便的方法来执行数据库操作,通过封装JDBC,减少了模板化的代码,提高了开发效率。本文介绍了的基本配置和使用方法,包括添加、查询等基本操作。通过实际代码示例,可以帮助开发者快速上手。版权声明:本博客内容为原创,转载请保留原文链接及作者信息。参考文章Spring JdbcTemplate详解Spring学习之JdbcTemplate。

ning的博客 1867

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

Spring:JdbcTemplate使用指南

Spring:JdbcTemplate使用指南    版权所有,转载请注明出处:http://blog.youkuaiyun.com/nomadsPDF 下载:点此处前言:本文指在介绍Spring框架中的JdbcTemplate类的使用方法,涉及基本的Spring反转控制的使用方法和JDBC的基本概念。目标是使读者能够对JdbcTemplate快速地掌握和使用。        准备:1

Nomad & His Life 4万+

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

Spring框架|集成JdbcTemplate

文章目录(1)编写Spring配置文件(2)配置数据源(3)配置JdbcTemplate模板对象(4)测试Spring框架集成JdbcTemplate 关于Spring的JdbcTemplate介绍 完整的XML配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.o...

匿名攻城狮 8170

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Spring07 —— Spring JdbcTemplate的使用

jdbcTemplate 是 Spring JDBC 核心包(core)中的核心类,它可以通过配置文件、注解、Java 配置类等形式获取数据库的相关信息,实现了对 JDBC 开发过程中的驱动加载、连接的开启和关闭、SQL 语句的创建与执行、异常处理、事务处理、数据类型转换等操作的封装。我们只要对其传入SQL 语句和必要的参数即可轻松进行 JDBC 编程。

春和的博客 1205

Spring5 框架【四】 JdbcTemplate

视频链接:2020最新版SpringCloud框架开发教程-周阳 文章源码:https://github.com/geyiwei-suzhou/spring5/ JdbcTemplate 概述和准备工作 什么是JdbcTemplate? (1)Spring框架对JDBC进行封装,使用JdbcTemplate方便实现对数据库操作 准备工作 (1)引入相关jar包 druid 提取码: 5ewy mysql-connector-java 提取码: sphm spring-jdbc-5.2.9.REL.

博客 283

【SSM】Spring JDBCTemplate总结

目录 一、基本介绍 二、环境搭建 三、JDBC Template基本使用 1.JdbcTemplate开发流程 2.JdbcTemplate常用方法 3.案例: ①:DDL,使用excute()方法进行创建一个user数据库表 ②:使用update对数据进行增删改(update只能执行一条sql) ③:使用batchUpdate对数据进行增删改(可以执行多条sql) ④:...

offer! 1418

spring JdbcTemplate

   Spring 的JDBC模板方法 Spring 通过模板方法模式,帮助程序员完成资源创建,资源管理等固定的的工作。程序员可专注于编写sql语句,处理结果集 。 JDBCTemplate 有一个DataSource 类型的成员变量为其创建所需要的连接资源 。 JdbcTemplate t = new JdbcTemplate( DataSource ) ;t.u

uptorun的专栏 1982

Spring——JdbcTemplate

JdbcTemplate 1、JdbcTemplate(概念和准备) 1.1、什么是 JdbcTemplate? Spring 框架对 JDBC 进行封装,使用 JdbcTemplate 方便实现对数据库操作。 1.2、准备工作 (1)引入相关 jar 包 [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-dsl09qA6-1639402734125)(素材/所需要的依赖.png)] (2)在 spring 配置文件配置数据库连接池 <!-- 数据库连接池 --> &

前尘忆梦的博客 1488
上一篇: Java常用类:时间处理示例代码
下一篇: Spring基础知识总结(五):Spring中的事务控制 与 Spring 5新特性
金心靖晨
博客等级 码龄9年 460粉丝 211原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值