当前位置: 首页 > news >正文

十七,Spring Boot 整合 MyBatis 的详细步骤(两种方式)

十七,Spring Boot 整合 MyBatis 的详细步骤(两种方式)

文章目录

  • 十七,Spring Boot 整合 MyBatis 的详细步骤(两种方式)
  • 1. Spring Boot 配置 MyBatis 的详细步骤
  • 2. 最后:


MyBatis 的官方文档:https://mybatis.p2hp.com/

在这里插入图片描述

关于 MyBatis 的学习的详细内容,大家可以移步至:✏️✏️✏️ MyBatis_ChinaRainbowSea的博客-CSDN博客 。

1. Spring Boot 配置 MyBatis 的详细步骤

  1. 首先,我们创建相关测试的数据库,数据表。如下:

在这里插入图片描述


CREATE DATABASE `springboot_mybatis`
USE `springboot_mybatis`CREATE TABLE `monster` (
`id` int not null auto_increment,
`age` int not null,
`birthday` DATE DEFAULT NULL,
`email` VARCHAR(255) DEFAULT NULL,
`gender` CHAR(1) DEFAULT null,
`name` VARCHAR(255) DEFAULT NULL,
`salary` DOUBLE not NULL,
PRIMARY KEY(`id`)
)SELECT * from monsterINSERT INTO  `monster` (`id`,`age` ,`birthday`,`email`,`gender`,`name`,`salary`) 
VALUES (1,20,'2000-10-10','nmw@sohu.com','男','牛魔王',9000.99)
INSERT INTO  `monster` (`id`,`age` ,`birthday`,`email`,`gender`,`name`,`salary`)
VALUES (2,10,'2000-12-12','bgj@sohu.com','女','白骨精',9999.99)
  1. 导入相关的 jar 依赖。这里我们使用 Druid 数据库连接池,同时我们还需要导入 mybatis.spring.boot 的。

在这里插入图片描述

<!--        引入 mybatis starter--><!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter --><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.2.2</version></dependency>

引入 Druid 数据库的 jar 依赖。

在这里插入图片描述

<!--        引入 druid 依赖--><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.1.17</version></dependency>

所有的 pom.xml 文件当中的 jar 依赖

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.rainbowsea</groupId><artifactId>springboot_mybaits</artifactId><version>1.0-SNAPSHOT</version><!--    导入SpringBoot 父工程-规定写法--><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.5.3</version></parent><!--    导入web项目场景启动器:会自动导入和web开发相关的jar包所有依赖【库/jar】--><!--    后面还会在说明spring-boot-starter-web 到底引入哪些相关依赖--><dependencies>
<!--        引入 web starter 依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!--        引入 mybatis starter--><!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter --><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.2.2</version></dependency><!--        引入 mysql 驱动: 这里老师使用版本仲裁 8.0.26--><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><!--        引入配置处理器--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-configuration-processor</artifactId></dependency><!--引入lombok--><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><!--        引入 test stater --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId></dependency><!--        引入 druid 依赖--><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.1.17</version></dependency></dependencies></project>
  1. 编写对应 数据表的在Java当中对应的 Bean 对象。

在这里插入图片描述

特殊说明:

这里使用 @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") 注解。来设置数据表当中的时间赋值到该 Bean 对象上的时间属性的一个时间格式。

  • pattern = "yyyy-MM-dd" 是设置时间显示的格式样式
  • timezone = "GMT+8" 是设置时区差。这里我们中国是东半球,时差为 + 8 个小时。

需要注意的是:这个注解只对前端显示,有效果,后端,控制台显示无效。

在这里插入图片描述

  1. 将Spring Boot 默认的 HikariCP 数据库连接池,切换为我们想要的 Druid 数据库连接池。

这里我们通过配置类的方式,进行切换。

在这里插入图片描述

package com.rainbowsea.springboot.mybatis.config;import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;import javax.sql.DataSource;@Configuration
public class DruidDataSourceConfig {@ConfigurationProperties(value = "spring.datasource")  // 读取 类路径下的application.yaml// 的信息,并为下面的 对应的 setXX 进行赋值操作@Beanpublic DataSource dataSource() {DruidDataSource druidDataSource = new DruidDataSource();return druidDataSource;}}

在 resource 类路径下创建一个,名为 applicaiton.yaml 文件,配置编写,相关对于,Druid 数据库连接池的信息。如下:

在这里插入图片描述

server:port: 9090  # 注意:使用空格spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverusername: rootpassword: MySQL123url: jdbc:mysql://localhost:3306/springboot_mybatis?useSSL=true&useUnicode=true&characterEncoding=UTF-8

在这里插入图片描述

  1. 编写项目的场景启动器

在这里插入图片描述

package com.rainbowsea.springboot.mybatis;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;@SpringBootApplication
public class Application {public static void main(String[] args) {ConfigurableApplicationContext ioc = SpringApplication.run(Application.class, args);}}
  1. 运行测试,我们是否成功切换为了,我们想要的 Duird 数据连接池,因为在 Spring Boot 当中测试的话,必须要编写好对应的项目启动器,不然,是无法测试的,会报错。

在这里插入图片描述

在这里插入图片描述

package com.rainbowsea.springboot.mybatis;import com.rainbowsea.springboot.mybatis.bean.Monster;
import com.rainbowsea.springboot.mybatis.mapper.MonsterMapper;
import com.rainbowsea.springboot.mybatis.service.MonsterService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;import javax.annotation.Resource;@SpringBootTest(classes = Application.class)  // 与 main 不同的需要指明 测试的是哪个Class类
public class ApplicationTest {@Resourceprivate JdbcTemplate jdbcTemplate;@Testpublic void t1() {// 输出看看当前的数据源是什么System.out.println(jdbcTemplate.getDataSource().getClass());}}
  1. 创建一个mapper/dao 的包,在该包下创建一个名为 MonsterMapper 的接口,通过代理类的方式,在该接口下,编写我们要执行业务的 SQL 语句的方法。

在这里插入图片描述

package com.rainbowsea.springboot.mybatis.mapper;import com.rainbowsea.springboot.mybatis.bean.Monster;
import org.apache.ibatis.annotations.Mapper;/*** 在Mapper接口使用 @Mapper 就会扫描,并将Mapper接口对象注入*/
@Mapper // 包扫描,加上了这个注解的话,那么
public interface MonsterMapper {// 方法 根据id 返回 Monster 对象public Monster getMonsterById(Integer id);}

特别说明:

这里我们在该 接口类当中,使用了 @Mapper 注解。该注解的作用就是,让Spring Boot 加载的时候,会扫描这个类。从而找到这个类。这样我们就不需要额外的配置,包扫描了

  1. 在相应的对应的包,下创建对应的包,创建对应 SQl 语句的xml 文件。如下

在这里插入图片描述

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.rainbowsea.springboot.mybatis.mapper.MonsterMapper">
<!--1. 扫描所有的dao接口的实现,加入到ioc容器中2. 这里dao接口,就是mapper接口
--><!--    配置 getMonsterById--><select id="getMonsterById" resultType="com.rainbowsea.springboot.mybatis.bean.Monster">select * from monster where id = #{id}</select>
<!--  elect * from `monster` where id = #{id} 注意: 不是单引号处理 -->
</mapper>

同时需要在,application.yaml 文件当中配置,Mybatis 的包扫描路径:如下;

在这里插入图片描述

mybatis:# 指定要扫描的 Xxxmapper.xmlmapper-locations: classpath:mapper/*.xml
server:port: 9090  # 注意:使用空格spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverusername: rootpassword: MySQL123url: jdbc:mysql://localhost:3306/springboot_mybatis?useSSL=true&useUnicode=true&characterEncoding=UTF-8mybatis:# 指定要扫描的 Xxxmapper.xmlmapper-locations: classpath:mapper/*.xml# 通过config-location 可以指定mybatis-config.xml 可以以传统的方式来配置mybatis
#  config-location:
# 我们可以直接在 application.yaml 进行配置
# 举例说明1,比如配置原来的 typeAliases# 还有很多配置,等我们用到再说
#  type-aliases-package: com.rainbowsea.springboot.mybatis.bean
#  configuration:
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#    map-underscore-to-camel-case: true# 老师说明: 配置mybatis的两种方式的选择: 如果配置比较简单,就直接在application.yaml配置
# 如配置内部比较多,可以考虑单独的做一个mybatis-config.xml

运行测试:

在这里插入图片描述

package com.rainbowsea.springboot.mybatis;import com.rainbowsea.springboot.mybatis.bean.Monster;
import com.rainbowsea.springboot.mybatis.mapper.MonsterMapper;
import com.rainbowsea.springboot.mybatis.service.MonsterService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;import javax.annotation.Resource;@SpringBootTest(classes = Application.class)  // 与 main 不同的需要指明 测试的是哪个Class类
public class ApplicationTest {@Resourceprivate MonsterMapper monsterMapper;@Testpublic void getMonsterById() {Monster monsterById = monsterMapper.getMonsterById(1);System.out.println(monsterById);}}

在这里插入图片描述

  1. 编写对应的 Severl 业务处理

首先,编写其接口:
在这里插入图片描述

package com.rainbowsea.springboot.mybatis.service;import com.rainbowsea.springboot.mybatis.bean.Monster;public interface MonsterService {// 根据id 返回 Monster 对象public Monster getMonsterById(Integer id);
}

在编写其接口的实现类,

在这里插入图片描述

package com.rainbowsea.springboot.mybatis.service.impl;import com.rainbowsea.springboot.mybatis.bean.Monster;
import com.rainbowsea.springboot.mybatis.mapper.MonsterMapper;
import com.rainbowsea.springboot.mybatis.service.MonsterService;
import org.springframework.stereotype.Service;import javax.annotation.Resource;@Service
public class MonsterServiceImpl implements MonsterService {// 装配MonsterMapper@Resourceprivate MonsterMapper monsterMapper;@Overridepublic Monster getMonsterById(Integer id) {return monsterMapper.getMonsterById(id);}
}

运行测试:

在这里插入图片描述

package com.rainbowsea.springboot.mybatis;import com.rainbowsea.springboot.mybatis.bean.Monster;
import com.rainbowsea.springboot.mybatis.mapper.MonsterMapper;
import com.rainbowsea.springboot.mybatis.service.MonsterService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;import javax.annotation.Resource;@SpringBootTest(classes = Application.class)  // 与 main 不同的需要指明 测试的是哪个Class类
public class ApplicationTest {// 装配到MonsterService@Resourceprivate MonsterService monsterService;// 测试 MonsterService@Testpublic void getMonsterById2() {Monster monster = monsterService.getMonsterById(2);System.out.println(monster);}}

在这里插入图片描述

  1. 编写对应的 Controller 控制器,在前端处理显示。

在这里插入图片描述

package com.rainbowsea.springboot.mybatis.controller;import com.rainbowsea.springboot.mybatis.bean.Monster;
import com.rainbowsea.springboot.mybatis.service.MonsterService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;import javax.annotation.Resource;@Controller
public class MonsterController {// 装配MonsterService@Resourceprivate MonsterService monsterService;@ResponseBody@GetMapping("/monster")public Monster getMonsterById( @RequestParam(value = "id") Integer id) {return monsterService.getMonsterById(id);}
}

运行测试:注意:我们这里配置的端口是9090,并不是8080。

在这里插入图片描述

2. 最后:

“在这个最后的篇章中,我要表达我对每一位读者的感激之情。你们的关注和回复是我创作的动力源泉,我从你们身上吸取了无尽的灵感与勇气。我会将你们的鼓励留在心底,继续在其他的领域奋斗。感谢你们,我们总会在某个时刻再次相遇。”

在这里插入图片描述

相关文章:

十七,Spring Boot 整合 MyBatis 的详细步骤(两种方式)

十七&#xff0c;Spring Boot 整合 MyBatis 的详细步骤(两种方式) 文章目录 十七&#xff0c;Spring Boot 整合 MyBatis 的详细步骤(两种方式)1. Spring Boot 配置 MyBatis 的详细步骤2. 最后&#xff1a; MyBatis 的官方文档&#xff1a;https://mybatis.p2hp.com/ 关于 MyBa…...

DNS协议解析

DNS协议解析 什么是DNS协议 IP地址&#xff1a;一长串唯一标识网络上的计算机的数字 域名&#xff1a;一串由点分割的字符串名字 网址包含了域名 DNS&#xff1a;域名解析协议 IP>域名 --反向解析 域名>IP --正向解析 域名 由ICANN管理&#xff0c;有级别&#xf…...

每日一题——第一百零八题

题目&#xff1a; 写几个函数&#xff0c; ①输入10个职工的姓名和职工号 ②按照职工号由小到大排列&#xff0c; 姓名顺序也随之调整 ③要求输入一个职工号&#xff0c; 用折半查找找出该职工的姓名 #include<stdio.h> #include<string.h> #define MAX_EMPOLYEES…...

使用Python免费将pdf转为docx

刚刚想将pdf转换为docx文档时&#xff0c;居然要收费 还好我学过编程&#xff0c;这不得露两手 将pdf 转换为 docx 文档 的操作步骤 我这里使用的是Python语言 &#xff08;1&#xff09;在终端上安装 pdf2docx 是一个 Python 库&#xff0c;它可以将 PDF 文件转换为 Word (…...

树莓派4B+UBUNTU20.04+静态ip+ssh配置

树莓派4B+UBUNTU20.04+静态ip+ssh配置 1.烧录Ubuntu镜像1.1选择pi 4b1.2选择ubuntu server (服务器版,无桌面)20.041.3选择sd卡1.4 点击右下角 NEXT ,编辑设置,输入密码,wifi选CN, 开启ssh1.5 烧录,依次点击“是”,等待完成2 烧录完成后装入树莓派,上电,等待系统完成配…...

C#实现指南:将文件夹与exe合并为一个exe

在软件开发过程中&#xff0c;有时需要将多个文件&#xff08;如资源文件、配置文件等&#xff09;与可执行文件&#xff08;exe&#xff09;打包在一起&#xff0c;以便于分发和部署。在C#中&#xff0c;我们可以利用ILMerge或Costura.Fody等工具来实现这一目标。本文将介绍如…...

linux信号 | 学习信号三步走 | 全解析信号的产生方式

前言&#xff1a;本节内容是信号&#xff0c; 主要讲解的是信号的产生。信号的产生是我们学习信号的第二个阶段。 我们已经学习过第一个阶段——信号的概念与预备知识&#xff08;没有学过的友友可以查看我的前一篇文章&#xff09;。 以及我们还没有学习信号的第三个阶段——信…...

C++ 刷题 使用到的一些有用的容器和函数

优先队列 c优先队列priority_queue&#xff08;自定义比较函数&#xff09;_c优先队列自定义比较-CSDN博客 373. 查找和最小的 K 对数字 - 力扣&#xff08;LeetCode&#xff09; 官方题解&#xff1a; class Solution { public:vector<vector<int>> kSmallestP…...

【Kubernetes】常见面试题汇总(三十四)

目录 86. K8s 每个 Pod 中有一个特殊的 Pause 容器能否去除&#xff0c;简述原因。 特别说明&#xff1a; 题目 1-68 属于【Kubernetes】的常规概念题&#xff0c;即 “ 汇总&#xff08;一&#xff09;~&#xff08;二十二&#xff09;” 。 题目 69-113 属于【Kuberne…...

C++标准库双向链表 list 中的insert函数实现。

CPrimer中文版&#xff08;第五版&#xff09;&#xff1a; //运行时错误&#xff1a;迭代器表示要拷贝的范围&#xff0c;不能指向与目的位置相同的容器 slist.insert(slist.begin(),slist.begin(),slist.end()); 如果我们传递给insert一对迭代器&#xff0c;它们不能…...

华为机考练习(golang)

输入 第一行输入一个正整数N&#xff0c;表示整数个数。&#xff08;0<N<100000&#xff09; 第二行输入N个整数&#xff0c;整数的取值范围为[-100,100]。 第三行输入一个正整数M&#xff0c;M代表窗口的大小&#xff0c;M<100000&#xff0c;且M<N。 输出 窗口…...

51单片机快速入门之按键应用拓展

51单片机快速入门之按键应用拓展 LED的点动控制: 循环检测,当key 为0 时 led 亮 反之为熄灭 while(1){ if(key!1) { led0; }else { led1; } } LED的锁定控制: 当按钮按下,led取反值 while(1) { if(key!1) { led!led; } } LED的4路抢答控制: bz默认为0 !bz 取反值,循环启动…...

数据库 - MySQL的事务

目录 前言 一、事务的特性 &#xff08;一&#xff09;原子性 &#xff08;二&#xff09;一致性 &#xff08;三&#xff09;隔离性 &#xff08;四&#xff09;持久性 二、事务的控制语句 三、事务隔离级别 &#xff08;一&#xff09;读未提交 &#xff08;二&…...

【Python机器学习】NLP信息提取——提取人物/事物关系

目录 词性标注 实体名称标准化 实体关系标准化和提取 单词模式 文本分割 断句 断句的方式 使用正则表达式进行断句 词性标注 词性&#xff08;POS&#xff09;标注可以使用语言模型来完成&#xff0c;这个语言模型包含词及其所有可能词性组成的字典。然后&#xff0c;该…...

vector类

一、STL库 vector 1.1 vector的介绍 vector英文意思为向量&#xff1a;向量是表示大小可以改变的数组的序列容器。 指向其元素的常规指针上的偏移量来访问其元素&#xff0c;并且与数组中的效率一样高。但与数组不同&#xff0c;它们的大小可以动态变化&#xff0c;其存储由容…...

python常见的魔术方法

什么是魔术方法 Python类的内置方法&#xff0c;各自有各自的特殊功能&#xff0c;被称之为魔术方法 常见的魔术方法有以下&#xff1a; __init__:构造方法 __str__:字符串方法 __lt__:小于、大于符号比较 __le__:小于等于、大于等于符合比较 __eq__:等于符合比较__init__ c…...

自动化测试常用函数:弹窗、等待、导航、上传与参数设置

目录 一、弹窗 1. 警告弹窗确认弹窗 2. 提示弹窗 二、等待 1. 强制等待 2. 隐式等待 3. 显示等待 三、浏览器导航 1. 打开网站 2. 浏览器的前进、后退、刷新 四、文件上传 五、浏览器参数设置 1. 设置无头模式 2. 页面加载策略 一、弹窗 弹窗是在页面是找不到任何…...

【必看】2024国赛选题分布情况分析及数模国赛答辩指南~答辩不走弯路

↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ 紧张刺激的数模国赛已经过去一段时间&#xff0c;各赛区的成绩发布也在陆续进…...

微服务注册中⼼1

1. 微服务的注册中⼼ 注册中⼼可以说是微服务架构中的”通讯录“ &#xff0c;它记录了服务和服务地址的映射关系。在分布式架构中&#xff0c; 服务会注册到这⾥&#xff0c;当服务需要调⽤其它服务时&#xff0c;就这⾥找到服务的地址&#xff0c;进⾏调⽤。 1.1 注册中⼼的…...

我设置了路由器自动切换ip,这会让我的账号登录地址经常改变吗

是的&#xff0c;路由器设置自动切换IP可能会导致你的账号登录地址经常改变。 这是因为当路由器切换IP时&#xff0c;外部网络所看到的你的设备IP地址也会随之改变。对于很多跨境电商、社交媒体或者银行账户等需要较高安全性的系统来说&#xff0c;经常变动的IP地址可能会被视…...

Nginx 限流实战教程和技巧

Nginx限流是一种重要的技术手段&#xff0c;用于保护服务器资源&#xff0c;防止因过度请求而导致的服务不可用。以下是一个详细的Nginx限流教程&#xff0c;包括限流原理、常用模块和配置示例。 一、Nginx限流原理 Nginx限流主要基于两种算法&#xff1a;漏桶算法和令牌桶算…...

AlphaFold3 | 详解 AlphaFold3 的模型结构及其在不同类型的预测实验中的表现

Jumper 本文将介绍 24 年 5 月发布的 Alaphafold3&#xff0c;其以“使用 AlphaFold 3 进行生物分子相互作用的精确结构预测”为标题发表在《nature》上&#xff0c;通讯作者为 Jumper。 Jumper 具有物理、化学、生物和计算方面的丰富背景。Jumper 本科学的是物理和数学&#…...

公交IC卡收单管理系统 多处 SQL注入致RCE漏洞复现

0x01 产品简介 公交IC卡收单管理系统是城市公共交通领域中不可或缺的一部分,它通过集成先进的集成电路技术(IC卡)实现了乘客便捷的支付方式,并有效提高了公共交通运营效率。系统集成了发卡、充值、消费、数据采集、查询和注销等多个功能模块,为公交公司和乘客提供了全面、…...

淘客系统开发之卷轴模式系统源码功能分析

随着互联网技术的快速发展&#xff0c;电商行业不断创新&#xff0c;探索更加高效、有趣的用户参与机制。其中&#xff0c;卷轴模式作为一种新兴的商业模式&#xff0c;以其独特的积分兑换和任务系统&#xff0c;在淘客系统开发中得到了广泛应用。本文将从技术角度&#xff0c;…...

MoCo中的字典

在 MoCo&#xff08;Momentum Contrast&#xff09;中&#xff0c;字典&#xff08;dictionary&#xff09;是一个核心组件&#xff0c;用于存储负样本&#xff08;negative samples&#xff09;的特征表示&#xff08;key&#xff09;。这个字典的设计使得 MoCo 可以高效地利用…...

Xcode16 iOS18 编译问题适配

问题1&#xff1a;ADClient编译报错问题 报错信息 Undefined symbols for architecture arm64:"_OBJC_CLASS_$_ADClient", referenced from:in ViewController.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit co…...

加密解密的艺术:探索Java中的DES算法

目录 1. 引言 2. DES算法简介 3. Java中的DES实现 4. 代码解析 5. 安全性考量 1. 引言 在数字化时代&#xff0c;数据安全变得至关重要。无论是个人隐私还是企业机密&#xff0c;都需要强有力的保护措施。今天&#xff0c;我们将探讨一种经典的数据加密技术——DES&#…...

jQuery——层次选择器

1、层次选择器&#xff1a;查找子元素&#xff0c;后代元素&#xff0c;兄弟元素的选择器。 ancestor descendant&#xff1a;在给定的祖先元素下匹配所有的后代元素 parent > child&#xff1a;在给定的父元素下匹配所有的子元素 prev next&#xff1a;匹配所有紧接在…...

MySQL常见面试总结

MySQL基础 什么是关系型数据库&#xff1f; 顾名思义&#xff0c;关系型数据库&#xff08;RDB&#xff0c;Relational Database&#xff09;就是一种建立在关系模型的基础上的数据库。关系模型表明了数据库中所存储的数据之间的联系&#xff08;一对一、一对多、多对多&…...

记录一次学习--委派攻击学习

目录 为什么要使用委派 什么账号可以使用委派 非约束性委派 这里有一张图 利用 流程 约束性委派 这里有一张图 如何利用 条件 具体流程 为什么要使用委派 这个是因为可能A服务需要B服务的支持&#xff0c;但是A服务的权限不可以使用B服务。然后这时就可以让域用户将…...