Spring-2-透彻理解Spring 注解方式创建Bean--IOC

news2024/10/7 14:31:13

今日目标

学习使用XML配置第三方Bean

掌握纯注解开发定义Bean对象

掌握纯注解开发IOC模式

1. 第三方资源配置管理

说明:以管理DataSource连接池对象为例讲解第三方资源配置管理

1.1 XML管理Druid连接池(第三方Bean)对象【重点】

数据库准备

-- 创建数据库
create database if not exists spring_druid character set utf8;
use spring_druid;
-- 创建表
create table if not exists tbl_account(
    id int primary key auto_increment,
    name varchar(20),
    money double
);
-- 插入数据
insert into tbl_account values(null,'张三',1000);
insert into tbl_account values(null,'李四',1000);
-- 查询所有
select * from tbl_account;

1.2 代码实现XML管理Druid连接池对象(第三方Bean)

【第一步】创建12_1_xml_druid项目

【第二步】Pom.xml添加Druid连接池依赖

 <dependencies>
    <!--导入spring的坐标spring-context,对应版本是5.3.15.RELEASE-->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>5.3.15</version>
    </dependency>
    <!-- mysql 驱动-->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.30</version>
    </dependency>
    <!--druid包-->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid</artifactId>
        <version>1.2.18</version>
    </dependency>
    <!-- 导入junit的测试包 -->
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>5.8.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.28</version>
    </dependency>
</dependencies>

【第三步】配置DruidDataSource连接池Bean对象 思考:配置数据库连接参数时,注入驱动类名是用driverClassName还是driver? 在resources下创建Spring的核心配置文件:application.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"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

  <!--1.创建连接池对象 DruidDataSource
    实际:  dataSource = new DruidDataSource();
  -->
  <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
      <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
      <property name="url" value="jdbc:mysql://localhost:3306/spring_druid"/>
      <property name="username" value="root"/>
      <property name="password" value="root"/>
  </bean>
</beans>

【第四步】在测试类中从IOC容器中获取连接池对象并打印

package com.zbbmeta;

import org.junit.jupiter.api.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class DataSourceTest {

    @Test
    public void test() throws SQLException {

        //目标:从IOC容器中获取德鲁伊连接池对象

        //1.创建IOC容器
        ClassPathXmlApplicationContext ac =
                new ClassPathXmlApplicationContext("application.xml");
        //2.获取连接池对象和数据库连接对象
        DataSource dataSource = ac.getBean(DataSource.class);
        Connection connection = dataSource.getConnection();
        //3.打印对象
        System.out.println("连接池对象:"+dataSource);
        System.out.println("连接象地址:"+connection);

        //4.关闭容器
        ac.close();

    }
}
  • 控制台结果:

现在我们的数据库参数都是写死在xml文件中的,我们讲解druid,是希望大家可以通过这个第三方Bean创建,实现我们举一反三实现其他第三方Bean的创建

思考:根据上面描述我们向如果有一千个第三方Bean需要创建,那么我们把每一个Bean的参数都写死在xml里面?

肯定不是的,所以我们要学习如何将参数数据进行提取出来,每一个Bean的参数单独放一个文件,方便我们查找和修改

1.3 加载properties属性文件【重点】

目的:将数据库的连接参数抽取到一个单独的文件中,与Spring配置文件解耦

1.3.1 properties基本用法

【第一步】在resources下编写jdbc.properties属性文件

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/spring_druid
username=root
jdbc.password=root

【第二步】在application.xml中开启开启context命名空间,加载jdbc.properties属性文件

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

【第三步】在配置连接池Bean的地方使用EL表达式获取jdbc.properties属性文件中的值

    <!--1.创建连接池对象 DruidDataSource
      实际:  dataSource = new DruidDataSource();
    -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
    <property name="driverClassName" value="${jdbc.driver}"/>
    <property name="url" value="${jdbc.url}"/>
    <property name="username" value="${username}"/>
    <property name="password" value="${jdbc.password}"/>
</bean>

【第四步】配置完成之后,运行之前的获取Druid连接池代码

思考:会不会运行成功

不会

严重: create connection SQLException, url: jdbc:mysql://127.0.0.1:3306/spring_druid, errorCode 1045, state 28000
java.sql.SQLException: Access denied for user 'zbb'@'localhost' (using password: YES)

为什么会出现这样的问题?

因为我们加载了系统的环变量

  • 解决1:换一个名称,例如不叫username,叫jdbc.username。(了解)

    【第五步】报错解决方式:在properties标签添加属性

<context:property-placeholder location="jdbc.properties" system-properties-mode="NEVER"/>

application.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:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

    <!--加载properties文件, ctrl + z 撤销
    ${键}: 取键对应的值
    system-properties-mode="NEVER": 不使用系统的环境变量
    location: 指定properties文件的位置
    location="jdbc.properties,msg.properties": 加载多个properties文件, 使用,逗号分割
    location="*.properties": 加载所有的properties文件,
                如果单元测试加载 src/test/resources里面的所有的properties
                如果main方法运行加载 src/main/resources里面的所有的properties

    location="classpath:*.properties" 加载类路径所有的properties文件, 用在Web应用中
    location="classpath*:*.properties" 加载类路径和依赖的jar中所有的properties文件, 用在Web应用中
    -->
    <context:property-placeholder location="jdbc.properties" system-properties-mode="NEVER"/>

    <!--1.创建连接池对象 DruidDataSource
      实际:  dataSource = new DruidDataSource();
    -->
    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
        <property name="driverClassName" value="${jdbc.driver}"/>
        <property name="url" value="${jdbc.url}"/>
        <property name="username" value="${username}"/>
        <property name="password" value="${jdbc.password}"/>
    </bean>
<!--    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://localhost:3306/spring_druid"/>
        <property name="username" value="root"/>
        <property name="password" value="root"/>
    </bean>-->
</beans>

2.Spring容器

2.1 创建容器

  • 方式一:类路径加载配置文件

ApplicationContext ctx = new ClassPathXmlApplicationContext("application.xml");
  • 方式二:文件路径加载配置文件

ApplicationContext ctx = new FileSystemXmlApplicationContext("D:\\application.xml");
  • 加载多个配置文件

ApplicationContext ctx = new ClassPathXmlApplicationContext("bean1.xml", "bean2.xml");

2.2 Spring容器中获取bean对象

  • 方式一:使用bean名称获取

弊端:需要自己强制类型转换

DataSource dataSource = (DataSource)ac.getBean("dataSource");
  • 方式二:使用bean名称获取并指定类型

弊端:推荐使用

DataSource dataSource = ctx.getBean("dataSource", DataSource.class);
  • 方式三:使用bean类型获取

弊端:如果IOC容器中同类型的Bean对象有多个,此处获取会报错

DataSource dataSource = ac.getBean(DataSource.class);

2.3 容器类层次结构

  • BeanFactory是IoC容器的顶层接口,初始化BeanFactory对象时,加载的bean延迟加载

  • ApplicationContext接口是Spring容器的核心接口,初始化时bean立即加载

  • ApplicationContext接口提供基础的bean操作相关方法,通过其他接口扩展其功能

  • ApplicationContext接口常用初始化类
    • ClassPathXmlApplicationContext(常用)

    • FileSystemXmlApplicationContext

    • AnnotationConfigApplicationContext

3. Spring注解开发

3.1 注解开发定义Bean对象【重点】

目的:xml配置Bean对象有些繁琐,使用注解简化Bean对象的定义

3.2代码实现注解开发

【第一步】创建12_2_annotation_ioc

【第二步】Pom.xml添加依赖

<dependencies>
    <!-- spring容器包 -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>5.2.10.RELEASE</version>
    </dependency>

    <!-- junit -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13</version>
        <scope>test</scope>
    </dependency>
</dependencies>

【第三步】在application.xml中开启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"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

    <!--开启IOC基础包扫描:目的是去到指定包下扫描IOC注解进行IOC功能使用
        spring框架优势:可插拔
            白话:使用这个功能就插入,不用这个功能就拔掉
            那么这个注解扫描的功能就符合可插拔的特性,配置上IOC注解扫描就进行扫描,不配置不会做扫描
    -->
    <context:component-scan base-package="com.zbbmeta" />
</beans>

【第四步】在类上使用@Component注解定义Bean。

public interface StudentDao {
    /**
     * 添加学生
     */
    void save();
}
package com.zbbmeta.dao.impl;

import com.zbbmeta.dao.StudentDao;
import org.springframework.stereotype.Component;

/**
 * @Component
 * 作用:相当于<bean>标签,用于创建IOC创建对象并加入IOC容器
 * 使用方法2种格式:
 *    @Component 创建对象并且设置对象别名为类名小驼峰,
 *              与<bean class="com.zbbmeta.dao.impl.StudentDaoImpl" id="studentDaoImpl"></bean>功能一样
 *    @Component("自定义别名") 创建对象并且设置别名加入IOC容器
 *
 *   IOC创建对象注解还有衍生的3个
 *      @Controller 定义表现层的对象
 *      @Service 定义业务层的对象
 *      @Repository 定义数据访问层的对象
 *      说明:这3个功能与@Component一样,只是为了增加可读性
 *            @Component适合在工具类的上面使用创建对象
 *
 */
@Component
public class StudentDaoImpl implements StudentDao {
    @Override
    public void save() {
        System.out.println("DAO: 添加学生信息到数据库...");
    }
}

补充说明:如果@Component注解没有使用参数指定Bean的名称,那么类名首字母小写就是Bean在IOC容器中的默认名称。例如:StudentDaoImpl对象在IOC容器中的名称是studentDaoImpl。

【第五步】在测试类中获取Bean对象

package com.zbbmeta;

import com.zbbmeta.dao.StudentDao;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class StudentDaoAnnotationTest {
    //目标:获取注解创建的Bean对象
    @Test
    public void testAnnotation(){
        //1.根据配置文件application.xml创建IOC容器
        ApplicationContext ac = new ClassPathXmlApplicationContext("application.xml");
        //2.从IOC容器里面获取id="studentDao"对象
        StudentDao studentDao = (StudentDao) ac.getBean("studentDaoImpl");
        System.out.println(studentDao);
    }
}

运行结果

com.zbbmeta.dao.impl.StudentDaoImpl@7d64e326

注意:每一个人获取的地址是不一样的

3.3 @Component三个衍生注解

说明:加粗的注解为常用注解

  • Spring提供**@Component**注解的三个衍生注解
    • **@Controller**:用于表现层bean定义

    • **@Service**:用于业务层bean定义

    • @Repository:用于数据层bean定义

说明:这3个功能与@Component一样,只是为了增加可读性

@Component适合在工具类的上面使用创建对象

@Repository
public class StudentDaoImpl implements StudentDao {
}

我们上面代码虽然类中都使用注解,但是我们还是存在xml,说明现在spring开发还不是完全的注解开发,可以称为半注解开发

4 Spring纯注解开发模式IOC【重点】

问题导入

思考:配置类上使用什么注解进行Spring注解包扫描替代xml中的配置?

4.1 纯注解开发模式介绍

  • Spring3.0开启了纯注解开发模式,使用Java类替代配置文件,开启了Spring快速开发赛道

  • Java类代替Spring核心配置文件

  • @Configuration注解用于设定当前类为配置类

  • @ComponentScan注解用于设定扫描路径

注意:此注解只能添加一次,多个数据请用数组格式

@ComponentScan({com.zbbmeta.service","com.zbbmeta.dao"})
  • 读取Spring注解配置类初始化容器对象

//加载配置类初始化容器
ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);

4.2 代码演示

【第零步】创建12_3_full_annotation_ioc项目并添加依赖

依赖和上一个项目相同

【第一步】定义配置类代替配置文件

@Configuration // 指定这个类为配置类,替代application.xml
@ComponentScan("com.zbbmeta")//代替<context:component-scan base-package="com.zbbmeta" />
//设置bean扫描路径,多个路径书写为字符串数组格式
//@ComponentScan({com.zbbmeta.service","com.zbbmeta.dao"})
public class SpringConfig {
}

【第二步】在测试类中加载配置类,获取Bean对象并使用

package com.zbbmeta;

import com.zbbmeta.config.SpringConfig;
import com.zbbmeta.service.StudentService;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class StudentDaoAnnotationTest {
    //目标:获取注解创建的Bean对象
    @Test
    public void testAnnotation(){
        //1.AnnotationConfigApplicationContext加载Spring配置类初始化Spring容器
        ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        StudentService studentService = (StudentService) ctx.getBean("studentServiceImpl");
        System.out.println(studentService);
        //按类型获取bean
        StudentService studentService2 = ctx.getBean(StudentService.class);
        System.out.println(studentService2);
    }
}

4.3 注解开发Bean作用范围和生命周期管理

问题导入

思考:在类上使用什么注解定义Bean的作用范围?

4.3.1 bean作用范围注解配置

  • 使用@Scope定义bean作用范围

@Component
@Scope("singleton")
public class StudentUtils {
}

4.3.2 bean生命周期注解配置

  • 使用@PostConstruct、@PreDestroy定义bean生命周期

package com.zbbmeta.utils;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;


@Component
@Scope("singleton")
public class StudentUtil {

    public StudentUtil() {
        System.out.println("Student constructor ...");
    }
    @PostConstruct
    public void init(){
        System.out.println("Student init ...");
    }
    @PreDestroy
    public void destroy(){
        System.out.println("Student destory ...");
    }
}

注意:@PostConstruct和@PreDestroy注解是jdk中提供的注解,从jdk9开始,jdk中的javax.annotation包被移除了,也就是说这两个注解就用不了了,可以额外导入一下依赖解决这个问题。

<dependency>
  <groupId>javax.annotation</groupId>
  <artifactId>javax.annotation-api</artifactId>
  <version>1.3.2</version>
</dependency>
  • 测试类

@Test
public void testStudentUtil(){
    //1.AnnotationConfigApplicationContext加载Spring配置类初始化Spring容器
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
    //按类型获取bean
    StudentUtil studentUtil = ctx.getBean(StudentUtil.class);
    System.out.println(studentUtil);
    //关闭容器
    ctx.close();
}

测试结果:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/850254.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Easys Excel的表格导入(读)导出(写)-----java

一,EasyExcel官网: 可以学习一些新知识: EasyExcel官方文档 - 基于Java的Excel处理工具 | Easy Excel 二,为什么要使用easyexcle excel的一些优点和缺点 java解析excel的框架有很多 &#xff1a; poi jxl,存在问题&#xff1a;非常的消耗内存&#xff0c; easyexcel 我们…

使用TDOSCommand调用Powershell脚本对进程进行操作

列出当前运行的进程&#xff1a; varPowerShellPath, ScriptPath, CommandLine: string; beginMemo6.Clear;PowerShellPath : powershell.exe ; // 假设 PowerShell 可执行文件在系统环境变量中// 构造命令行参数CommandLine : Get-Process | Select-Object Name,Id;// 设置命…

【Linux】总结2-进程篇1

文章目录 冯诺伊曼结构操作系统什么是程序&#xff1f;什么是进程&#xff1f;操作系统是如何来管理进程的&#xff1f;PCB&#xff08;struct task_struct{...}&#xff09; 冯诺伊曼结构 冯诺依曼提出了计算机制造的三个基本原则&#xff0c;即采用二进制逻辑、程序存储执行…

Stable Diffusion - 常用的负向提示 Embeddings 解析与 坐姿 (Sitting) 提示词

欢迎关注我的CSDN&#xff1a;https://spike.blog.csdn.net/ 本文地址&#xff1a;https://spike.blog.csdn.net/article/details/132145248 负向 Embeddings 是用于提高 StableDiffusion 生成图像质量的技术&#xff0c;可以避免生成一些不符合预期的图像特征&#xff0c;比如…

day5gdb调试模式和makefile

一、gdb调试 1.1gdb调试的作用 gdb调试检查的是逻辑错误&#xff0c;而非语法错误 1.2gdb流程 1、gcc -g 1.c ---->加-g参数的作用&#xff0c;生成可以调试的gdb文件 2、gdb 可执行文件名/a.out ---->进入gdb工具进行调试 3、输入l&#xff0c;带行号打印文件信息…

管理类联考——逻辑——论证逻辑——汇总篇——目录+提炼

文章目录 一、削弱方法关系的削弱必要方法的削弱因果推理的削弱果因推理的削弱概念跳跃的削弱数量比例的削弱比例因果的削弱 二、支持方法关系的支持必要方法的支持因果推理的支持果因推理的支持概念跳跃的支持数量比例的支持比例因果的支持 三、假设方法关系的假设必要方法的假…

不分股权不分管理,只分利润:共享模式的新零售布局

实体行业如何通过共享模式去整合那些有资源的人&#xff0c;来完成新零售的一个布局&#xff1f;比如对于餐饮行业而言&#xff0c;一样的资源&#xff0c;经常有用餐、聚餐需求的人是谁&#xff1f; 有商会组织者、公司的管理层、培训机构、社群群主等等。那么如何把这些人整…

记一次Linux启动Mysql异常解决

文章目录 第一步&#xff1a; netstat -ntlp 查看端口情况2、启动Mysql3、查看MySQL日志 tail -100f /var/log/mysqld.log4、查看磁盘占用情况&#xff1a;df -h5、思路小结 第一步&#xff1a; netstat -ntlp 查看端口情况 并没有发现3306数据库端口 2、启动Mysql service …

【Windows】Windows11系统用户自己添加开机启动项的方法

按win R快捷键&#xff0c;打开运行窗口&#xff0c;在输入框中输入shell:startup后点击运行&#xff0c;打开启动文件夹&#xff1a; 把想增加的开机启动软件的快捷方式图标拖入到该文件夹中&#xff0c;如下图所示&#xff1a; 按ctrl shift esc打开任务管理器&#xff0c…

UWB伪应用场景 - 别再被商家忽悠

近几年UWB技术在网上宣传得如火如荼&#xff0c;与高精度定位几乎或等号&#xff0c;笔者认为这是营销界上的一大成功案例。 UWB超宽带技术凭借着低功耗、高精度&#xff0c;确实在物联网行业混得风生水起&#xff0c;但在无数实际应用案例中&#xff0c;根据客户的反馈情况&a…

python小游戏代码200行左右,python小游戏代码1000行

大家好&#xff0c;小编为大家解答20行python代码的入门级小游戏的问题。很多人还不知道python小游戏代码200行左右&#xff0c;现在让我们一起来看看吧&#xff01; 大家小时候都玩过贪吃蛇吧&#xff1f;小编小时候可喜欢拿爸妈的手机玩了&#xff0c;厉害着呢&#xff01;今…

Spring-2-深入理解Spring 注解依赖注入(DI):简化Java应用程序开发

今日目标 掌握纯注解开发依赖注入(DI)模式 学习使用纯注解进行第三方Bean注入 1 注解开发依赖注入(DI)【重点】 问题导入 思考:如何使用注解方式将Bean对象注入到类中 1.1 使用Autowired注解开启自动装配模式&#xff08;按类型&#xff09; Service public class StudentS…

redis基础(三十六)

安装redis、配置redis 目录 一、 概述 &#xff08;一&#xff09;NoSQL 1、类型 2、应用场景 &#xff08;二&#xff09;Redis 二、安装 &#xff08;一&#xff09;编译安装 &#xff08;二&#xff09;RPM安装 三、目录结构 四、命令解析 五、redis登录更改 1、…

三层交换实验

前言 在实际的企业应用中&#xff0c;我们会先建立不同的vlan把用户先隔开来。然后再通过三次交换机技术打通vlan直接的网络。 这样的目的如下&#xff1a; 隔离&#xff1a; 隔离是广播域&#xff0c;也就是隔离的是故障连通&#xff1a; 连通的是正常的通信 比如校园网&am…

在魔塔社区搭建通义千问-7B(Qwen-7B)流程

复制以下语句 python3 -m venv myvenvsource myvenv/bin/activatepip install modelscope pip install transformers_stream_generator pip install transformers pip install tiktoken pip install accelerate pip install bitsandbytestouch run.py vi run.py复制下面代码粘…

IMV5.0

背景内容&#xff1a; 经历了多个版本&#xff0c;基础内容在前面&#xff0c;可以使用之前的基础环境&#xff1a; v1&#xff1a; https://blog.csdn.net/wtt234/article/details/132139454 v2&#xff1a; https://blog.csdn.net/wtt234/article/details/132144907 v3&#…

04-8_Qt 5.9 C++开发指南_QTableWidget的使用

文章目录 1. QTableWidget概述2. 源码2.1 可视化UI设计2.2 程序框架2.3 qwintspindelegate.h2.4 qwintspindelegate.cpp2.5 mainwindow.h2.6 mainwindow.cpp 1. QTableWidget概述 QTableWidget是Qt中的表格组件类。在窗体上放置一个QTableWidget 组件后,可以在 PropertyEditor…

二、 MySQL 内部技术架构

二、 MySQL 内部技术架构 047 Mysql内部支持缓存查询吗&#xff1f; 当MySQL接收到客户端的查询SQL之后&#xff0c;仅仅只需要对其进行相应的权限验证之后&#xff0c;就会通过Query Cache来查找结果&#xff0c;甚至都不需要经过Optimizer模块进行执行计划的分析优化&…

产品缺陷管理软件:了解功能与选择要点

在现代社会&#xff0c;产品缺陷管理软件已经成为了各个行业必不可少的工具。它可以帮助企业更好地管理和解决产品中存在的缺陷问题&#xff0c;提高产品质量和客户满意度。然而&#xff0c;市场上存在着众多的产品缺陷管理软件&#xff0c;如何选择一款好用、适合自己的软件成…

Java实现数字加密

Java实现数字加密 需求分析代码实现小结Time 需求分析 1.首先&#xff0c;考虑方法是否需要接收数据处理&#xff1f; 需要一个4位数&#xff0c;至于是哪一个数&#xff0c;让方法的调用者传递。 所以&#xff0c;方法的参数&#xff0c;就是这个需要加密的四位数 2.接着&…