Spring框架 基础介绍

news2024/9/19 10:34:09

目录

Spring框架

IOC:

AOP:

一站式:

spring搭建

Maven 导入 spring 核心基础 jar

编写 spring 配置文件

编写一个 User 实体类

测试 spring

IOC(控制反转)

依赖注入:

1、通过属性注入

2、通过构造方法注入

spring中bean管理

1、基于xml配置方式

2、基于注解方式

添加注解标签:

在一个类中要用到另外的类通过注解标签来自动注入

@Autowired

@Resource

Spring 数据访问层管理

Spring 集成 Mybatis

1、导入 mybatis jar 包

Spring 结合 mybatis 插件包等等 

2、配置 sqlSessionFactory

3、指定生成接口代理

4、在 service 中注入 Dao 代理接口,此接口有 Spring 代理实现

Test测试


Spring框架

Spring 是一个轻量级,IOC 和 AOP 的一站式 Java 开发框架,是为了简化企
业级应用开发而生的。
轻量级:框架体积小(核心模块)

IOC:

即 Inversion of Control(控制反转),缩写为 IOC,是把创建对象的控制权,反转给 Spring 框架管理对象,而非传统实现中由程序代码直接操控。

AOP:

Aspect Oriented Programming (面向切面编程) 。
AOP 是一种编程思想,是面向对象编程(OOP)的一种补充。面向对象编程将程序抽象成各
个层次的对象,而面向切面编程是将程序抽象成各个切面.
将程序中的一些公共的非业务代码分离提取出来,然后在业务代码执行时,给他们横切进来。
使用的动态代理的机制实现,在我们的业务代码, 不显示的调用。在执行业务代码,会由代理对象调用 提交事务的代码。

一站式:

除了核心的IOC和AOP功能之外,还对数据访问层,web层都有封装,所以是一站式框架。

spring搭建

Maven 导入 spring 核心基础 jar

<!-- spring-context -->
< dependency >
       < groupId >org.springframework</ groupId >
       < artifactId >spring-context</ artifactId >
       < version >5.2.2.RELEASE</ version >
</ dependency >

spring bean 管理
          bean对象,由于把对象交给spring管理后,spring会对对象进行 功能的增强
所以在spring框架中生成的对象,统一称为 bean对象。
         区分这个对象是我们自己new的还是spring框架生成的。

编写 spring 配置文件

 使用bean标签,配置需要让spring管理的类.
  id="对象名称,可以在getBean中获得spring生成的对象".
  class="需要让spring管理的类的地址".
  scope="配置bean的作用域".
  scope="singleton"=>单例的(默认) (在spring框架启动时,就创建对象,而且始终只创建了一个对象。)
  scope="prototype"=>原型的(多例的) 在每次获得对象时,创建一个新的对象.
<?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">

 <!--在spring的配置文件注册需要spring框架管理的类-->

        <bean id="admin" class="com.ffyc.springpro.model.Admin" scope="singleton" >

</beans>

编写一个 User 实体类

测试 spring

package com.ffyc.springpro.test;

import com.ffyc.springpro.model.Admin;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test1 {
    public static void main(String[] args) {
        //Admin admin=new Admin();
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring.xml");
        Admin admin=(Admin) applicationContext.getBean("admin");
        Admin admin1=applicationContext.getBean("admin",Admin.class);
        System.out.println(admin);
        System.out.println(admin1);
    }
}

IOC(控制反转)

IOC:指的是让spring框架创建对象,创建对象的同时,还有一个动作称为依赖注入。

依赖注入:

依赖注入是指在创建对象的时候,为对象中属性赋值。
依赖注入有两种方式:
   1、通过属性注入,(属性的set方法注入)
   2、通过构造方法注入
1、通过属性注入

(属性的set方法注入)

<!--通过get,set方法注入-->
<property name="account" value="admin"></property>
<property name="password" value="1111"></property>

2、通过构造方法注入
<!--通过构造方法注入-->
<constructor-arg name="account" value="admin1"></constructor-arg>
<constructor-arg name="password" value="1212"></constructor-arg>

spring中bean管理

有两种方式。

1、基于xml配置方式

id="对象名称,可以在getBean中获得spring生成的对象"。
class="需要让spring管理的类的地址"。
scope="配置bean的作用域".。
scope="singleton"=>单例的(默认) (在spring框架启动时,就创建对象,而且始终只创建了一个对象。)
scope="prototype"=>原型的(多例的) 在每次获得对象时,创建一个新的对象。
request: 每次 http 请求都会创建一个 bean, 仅 用 于 WebApplicationContext 环境。
<?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">


          <!--在spring的配置文件注册需要spring框架管理的类
               使用bean标签,配置需要让spring管理的类
               id="对象名称,可以在getBean中获得spring生成的对象"
               class="需要让spring管理的类的地址"
               scope="配置bean的作用域"
               scope="singleton"=>单例的(默认) (在spring框架启动时,就创建对象,而且始终只创建了一个对象。)
               scope="prototype"=>原型的(多例的) 在每次获得对象时,创建一个新的对象

              IOC:指的是让spring框架创建对象,创建对象的同时,还有一个动作称为依赖注入。
             依赖注入:在创建对象的时候,为对象中属性赋值
             依赖注入有两种方式:
                1、通过属性注入,(属性的set方法注入)
                2、通过构造方法注入

          -->
    <bean id="admin" class="com.ffyc.springpro.model.Admin" scope="singleton" >
        <!--通过get,set方法注入-->
<!--        <property name="account" value="admin"></property>-->
<!--        <property name="password" value="1111"></property>-->
        <!--通过构造方法注入-->
        <constructor-arg name="account" value="admin1"></constructor-arg>
        <constructor-arg name="password" value="1212"></constructor-arg>
    </bean>

    <bean id="adminDao" class="com.ffyc.springpro.dao.AdminDao"></bean>
    <bean id="adminService" class="com.ffyc.springpro.service.AdminService">
        <!--name="adminDao"拿到是adminService中的属性名对应   ref="adminDao"引用的是id为adminDao的AdminDao中的对象 注入进来    -->
        <property name="adminDao" ref="adminDao"></property>

    </bean>
</beans>

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"
       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">


<!--    开启spring注解扫描功能  指定扫描的包-->
    <context:component-scan base-package="com.ffyc.springpro"> </context:component-scan>
</beans>
添加注解标签:
@Component(value = "admin")
@Scope(value = "prototype")

不同层用不同的注解标签

@Repository(value = "adminDao")
@Service(value = "adminService")
@Autowired
package com.ffyc.springpro.model;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

//等同于xml中 <bean id="admin" class="com.ffyc.springpro.model.Admin" scope="singleton" >
@Component(value = "admin")
@Scope(value = "prototype")//scope=""
public class Admin {
    private String account;
    private String password;

    public Admin() {
        System.out.println("无参");
    }

    public Admin(String account, String password) {
        this.account = account;
        this.password = password;
        System.out.println("有参");
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        System.out.println("setAccount");
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        System.out.println("setPassword");
        this.password = password;
    }

    @Override
    public String toString() {
        return "Admin{" +
                "account='" + account + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
在一个类中要用到另外的类通过注解标签来自动注入
@Autowired
spring注解方式Bean管理,自动注入。
   @Autowired 是spring框架提供的注解,用于在属性和属性的set方法上,如果写在属性上,set方法都可以不需要了。
   默认情况下,要注入的值不能为空。默认值 :required==true;
自动注入有两种值的匹配方式:
    1、通过属性的类型查找
    2、通过对象的名字查找
        @Qualifier(value = "adminDao")
@Resource
@Resource 是java语言中提供的注解标签
     也是添加在属性上,不需要写set方法。
     注入的值也不能为空。
     可以通过属性的类型查找。
     也可以通过对象的名字查找。
package com.ffyc.springpro.service;

import com.ffyc.springpro.dao.AdminDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service(value = "adminService")
public class AdminService {

    /*
         spring注解方式Bean管理  自动注入
             @Autowired 是spring框架提供的注解,用于在属性和属性的set方法上,如果写在属性上,set方法都可以不需要了。
             默认情况下,要注入的值不能为空。required==true;默认值

        自动注入有两种值的匹配方式:
            1、通过属性的类型查找
            2、通过对象的名字查找
                @Qualifier(value = "adminDao")


             @Resource 是java语言中提供的注解标签
                  也是添加在属性上,不需要写set方法。
                  注入的值也不能为空。
                  可以通过属性的类型查找。
                  也可以通过对象的名字查找。



     */
    //@Autowired
    //@Qualifier(value = "adminDao")

    @Resource
    //@Resource(name = "adminDao")
    AdminDao adminDao;

    public void saveAdmin(){
        adminDao.saveAdmin();
    }
}

Spring 数据访问层管理

Spring 是个一站式框架:Spring 自身也提供了 web 层的 SpringWeb 和 持久层的 Spring JdbcTemplate

导入包
下载 Spring jdbc 数据访问层 jar 包
<!-- spring-jdbc -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>5.2.2.RELEASE</version>
</dependency>

<!--mysql-->
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.16</version>
</dependency>

<!-- 阿里巴巴数据库链接管理组件 专门负责创建数据库链接的操作-->
<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>druid</artifactId>
    <version>1.1.10</version>
</dependency>
管理数据源对象
<!--
阿里巴巴数据库连接管理对象,负责生成数据库连接对象,以及提供数据库链接池功能
接下俩让spring管理阿里巴巴数据库连接对象。
-->
<bean id="druidDataSource" class="com.alibaba.druid.pool.DruidDataSource">
    <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"></property>
    <property name="url" value="jdbc:mysql://127.0.0.1:3306/ssmdb?serverTimezone=Asia/Shanghai"></property>
    <property name="username" value="root"></property>
    <property name="password" value="root"></property>
    <property name="initialSize" value="10"></property><!--初始化连接数量-->
    <property name="maxActive" value="20"></property><!--最大连接数量-->
</bean>

 配置spring中对jdbc进行封装的操作类型:

  <!--
      配置spring中对jdbc进行封装的操作类型  JdbcTemplate
   -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
       <!--JdbcTemplate定义的属性名-->
    <property name="dataSource" ref="druidDataSource"></property>
</bean>

package com.ffyc.springpro.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
//不同层使用不同的标签
@Repository//(value = "adminDao")
public class AdminDao {

    @Autowired
    JdbcTemplate jdbcTemplate;

    public void saveAdmin(){
        //jdbcTemplate.execute("create table ");//主要实行创建表的ddl语句,没有返回值
        jdbcTemplate.update("insert into admin(account,password,gender) values (?,?,?)","张山","11212","女");
    }
}

Spring 集成 Mybatis

Spring 集成 Mybatis 其核心是将 SqlSessionFactory 交由 Spring 管理,并由
Spring 管理对 dao 接口的代理实现。
1、导入 mybatis jar 包
Spring 结合 mybatis 插件包等等 
<?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.example</groupId>
    <artifactId>ssm</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>ssm</name>
    <packaging>war</packaging>

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
        <junit.version>5.6.2</junit.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>8.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- spring-context spring核心jar包-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.2.2.RELEASE</version>
        </dependency>

        <!-- spring-jdbc -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>5.2.2.RELEASE</version>
        </dependency>

        <!--mysql-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.16</version>
        </dependency>

        <!-- 阿里巴巴数据库链接管理组件 专门负责创建数据库链接的操作-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.1.10</version>
        </dependency>

        <!--mybatis-->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.4.2</version>
        </dependency>

        <!--Spring 结合 mybatis 插件包-->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>1.3.1</version>
        </dependency>


        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.10</version>
        </dependency>


    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.0</version>
            </plugin>
        </plugins>
    </build>
</project>

2、配置 sqlSessionFactory
3、指定生成接口代理
<?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">


    <!--开启spring注解扫描功能  指定扫描的包-->
    <context:component-scan base-package="com.ffyc.ssm"> </context:component-scan>
    <!--
    阿里巴巴数据库连接管理对象,负责生成数据库连接对象,以及提供数据库链接池功能
    让spring管理阿里巴巴数据库连接对象-->
    <bean id="druidDataSource" class="com.alibaba.druid.pool.DruidDataSource">
        <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"></property>
        <property name="url" value="jdbc:mysql://127.0.0.1:3306/ssmdb?serverTimezone=Asia/Shanghai"></property>
        <property name="username" value="root"></property>
        <property name="password" value="root"></property>
        <property name="initialSize" value="10"></property><!--初始化连接数量-->
        <property name="maxActive" value="20"></property><!--最大连接数量-->
    </bean>

    <!--往spring管理生成SqlSessionFactory对象-->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="druidDataSource"></property><!--注入数据源-->
        <property name="configLocation" value="classpath:mybatis.xml"></property><!--配置mybatis配置文件-->
        <property name="mapperLocations" value="classpath:mappers/LoginDao.xml"><!--扫描mappers映射文件-->
        </property>
    </bean>


    <!--生成dao包下所有接口的代理对象 指定生成接口代理-->
    <bean id="mapperFactory" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="com.ffyc.ssm.dao"></property>
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory">
        </property>
    </bean>

</beans>
4、在 service 中注入 Dao 代理接口,此接口有 Spring 代理实现
package com.ffyc.ssm.service;

import com.ffyc.ssm.dao.LoginDao;
import com.ffyc.ssm.model.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginService {
    @Autowired
    LoginDao loginDao;

    public Admin login(Admin admin){
        Admin admin1=loginDao.login(admin);
        return admin1;
    }

}
Test测试
package com.ffyc.ssm.test;

import com.ffyc.ssm.model.Admin;
import com.ffyc.ssm.service.LoginService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {

    public static void main(String[] args) {
        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("spring.xml");
        LoginService loginService=applicationContext.getBean("loginService",LoginService.class);

        Admin admin=new Admin();
        admin.setAccount("admin");
        admin.setPassword("111");

        Admin admin1=loginService.login(admin);
        System.out.println(admin1);
    }
}

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

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

相关文章

AI模型:追求全能还是专精?

AI模型&#xff1a;追求全能还是专精&#xff1f; 近日&#xff0c;OpenAI预计在秋季推出代号为“草莓”的新AI。从专注于数学问题到处理主观营销策略&#xff0c;"草莓"模型展现出惊人的多样性。而这种全能型 AI 是否代表了未来趋势&#xff1f;相比专攻于某一领域…

I get HttpClient.Timeout Error in C# OpenAI library

题意&#xff1a;“我在 C# OpenAI 库中遇到 HttpClient.Timeout 错误。” 问题背景&#xff1a; I am using the OpenAI library in my c# project, but I get the following error if it does not receive a response for more than 100 seconds. I cannot add a custom htt…

宠物空气净化器应该怎么选择?希喂、IAM、有哈哪款性价比高

在当今社会&#xff0c;养宠已然渐渐成为现在年轻人生活中的一种标配。可爱的宠物们以它们的忠诚、活泼与温暖&#xff0c;给予像我们这类年轻人无尽的陪伴。这种陪伴在时光的消逝中渐渐升华&#xff0c;成为年轻人心灵的慰藉和生活中不可或缺的一部分。然而&#xff0c;在享受…

【软件测试】软件测试生命周期与Bug

目录 &#x1f4d5; 前言 &#x1f334;软件测试的生命周期 ​编辑&#x1f332;BUG &#x1f6a9; 概念 &#x1f6a9;描述bug的要素 &#x1f6a9;bug的级别 &#x1f6a9;bug的生命周期 &#x1f3c0;先检查自身&#xff0c;是否bug描述不清楚 &#x1f3c0;站在用…

JavaScript学习文档(9):事件流、事件委托、其他事件、元素尺寸与位置

目录 一、事件流 1、事件流的两个阶段 2、事件捕获 3、事件冒泡 4、阻止冒泡 5、解绑事件 &#xff08;1&#xff09;解绑事件 &#xff08;2&#xff09;鼠标经过事件区别 二、事件委托 1、优点 2、原理 3、实现 4、tab栏切换案例改造 三、其他事件 1、页面加载…

不可不知的HDMI之前世今生

1、HDMI的产生 2002年4月&#xff0c;来自电子电器行业的7家公司——日立、松下、飞利浦、SiliconImage、索尼、汤姆逊、东芝&#xff0c;共同组建了HDMI接口组织——HDMIFounders&#xff08;HDMI论坛&#xff09;&#xff0c;开始着手制定一种符合高清时代标准的全新数字化视…

nginx转发接口地址【非常实用】

使用场景 由于客户的需求是要访问一个外网接口 比如http://58.20.57.190:6652 实例 http://58.20.57.190:6652//uploadBasePatient?Barcode1000000073&customerCode1 比如外网才能访问&#xff0c;科室电脑是访问不了外网的 我们就需要中间在一个既有外网又有内网的前置…

数据结构(邓俊辉)学习笔记】串 09——BM_BC算法:以终为始

文章目录 1. 不对称性2. 善待教训3.前轻后重4.以终为始 1. 不对称性 上一节所介绍的 KMP 算法计算时间&#xff0c;在最坏情况下也可以保证不超过线性。这的确是一个好消息。然而&#xff0c;倘若我们因此就停下继续优化的脚步&#xff0c;那就大错特错了。 实际上&#xff0c…

如何在Java爬虫中设置代理IP:详解与技巧

在进行网络爬虫时&#xff0c;使用代理IP可以有效地避免被目标网站封禁&#xff0c;提升数据抓取的成功率。本文将详细介绍如何在Java爬虫中设置代理IP&#xff0c;并提供一些实用的技巧和示例代码。 为什么需要代理IP&#xff1f; 在进行爬虫操作时&#xff0c;频繁的请求可能…

深度学习基础—彩色图片的卷积运算

深度学习基础—卷积运算http://t.csdnimg.cn/2mRei 上篇文章卷积运算实际是灰度图像的运算&#xff08;2维空间&#xff09;&#xff0c;但是实际中我们彩色图片使用的更多&#xff0c;和灰度图像不同的是&#xff1a;彩色图片是由三原色&#xff08;红、绿、蓝&#xff09;组成…

C# 对桌面快捷方式的操作设置开机启动项

首先在项目中引入Windows Script Host Object Model&#xff0c;引入方式如下图。 对于桌面快捷方式的修改无非就是将现有的快捷方式修改和添加新的快捷方式。 1、遍历桌面快捷方式&#xff0c;代码如下。 string desktopPath Environment.GetFolderPath(Environment.Special…

机器学习:DBSCAN算法(内有精彩动图)

目录 前言 一、DBSCAN算法 1.动图展示&#xff08;图片转载自网络&#xff09; 2.步骤详解 3.参数配置 二、代码实现 1.完整代码 2.代码详解 1.导入数据 2.通过循环确定参数最佳值 总结 前言 DBSCAN&#xff08;Density-Based Spatial Clustering of Applications w…

World of Warcraft [CLASSIC][80][Grandel] Call to Arms: Strand of the Ancients

Call to Arms: Strand of the Ancients - Quest - 魔兽世界怀旧服CTM4.34《大地的裂变》数据库_大灾变85级魔兽数据库_ctm数据库 Call to Arms: Strand of the Ancients 战斗的召唤&#xff1a;远古海滩 打掉最后一个门【古代圣物之厅】&#xff0c;人跳进去就赢了

算法之二分查找法和双指针

用二分查找法刷leetcode算法题目的时候&#xff0c;经常遇到视频看着理解很透彻&#xff0c;当上手写时一看就会&#xff0c;一写就废。二分查找法涉及边界条件很多&#xff0c;逻辑很简单&#xff0c;就是写不好。何时写 while(left<right)&#xff0c;while(left<right…

【动态规划】背包问题 - 二维费用的01背包问题

文章目录 1. 前言2. 二位费用的01背包问题2.1_一和零2.2_盈利计划2.3_珠宝的最高价值 3. 似包非包问题3.1_不同的二叉搜索树3.2_组合总和Ⅳ 1. 前言 关于 动态规划的理解 与例题&#xff0c;点击&#x1f447; 【动态规划】C解决斐波那契模型题目&#xff08;三步问题、爬楼梯…

winXP下构建python开发环境

近期车间有个动平衡检测仪数采的需求&#xff0c;工控机是xp系统&#xff0c;原理也很简单&#xff0c;监控文件变化&#xff0c;发现有新的检测数据就调用远程接口传输到服务器上去。 通常python监控文件变化会用watchdog这个库&#xff0c; 可是xp太老了&#xff0c;测试了一…

身份实名认证-身份证实名认证-身份证实名-实名认证-身份证二要素-身份证实名认证-身份实名认证-身份证号码实名认证核验校验接口

身份证号码实名认证接口API是一种服务&#xff0c;它允许开发者或企业通过编程方式验证用户提供的身份证号码是否真实有效&#xff0c;以及该身份证号码与提供者的姓名是否匹配。这种服务对于确保用户身份的真实性、防止欺诈行为以及遵守相关法律法规&#xff08;如反洗钱法、网…

自博弈-PSRO类方法综述

参考文章&#xff1a;PSRO2024最新综述 关键名词 解释 Meta-Strategy Solver (MSS) 元博弈求解器&#xff0c;从现有策略集合中提取meta-strategy&#xff08;策略集合中每个策略对应一个权重&#xff09;用于构造新策略的优化目标 Response Objective&#xff08;RO&#…

【系统分析师】-缓存

目录 1、常见分类 2、集群切片方式 3、Redis 3.1、分布式存储方式 3.2、数据分片方式 3.3、数据类型 3.4、持久化方案 3.5、内存淘汰机制 3.6、Redis常见问题 4、布隆过滤器 1、常见分类 1、MemCache Memcache是一个高性能的分布式的内存对象缓存系统&#xff0c;用…

RocketMQ:高速消息中间件的秘密武器

人不走空 &#x1f308;个人主页&#xff1a;人不走空 &#x1f496;系列专栏&#xff1a;算法专题 ⏰诗词歌赋&#xff1a;斯是陋室&#xff0c;惟吾德馨 关于RocketMQ的详细图表&#xff0c;包含了Producer、Consumer、Broker和NameServer等关键组件&#xff0c;展示…