spring练习1

news2024/11/20 2:19:16

1、练习网站案例

1、建好相应的java类

package spring;

public class Player {
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    private int id;
    private String name;
    private String position;
}

2、准备好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:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/aop
   http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
   http://www.springframework.org/schema/tx
   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
   http://www.springframework.org/schema/context     
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">
  
    <bean name="" class="spring.Player">
        <property name="name" value="niko" />
        <property name="position" value="步枪手" />
    </bean>
  
</beans>

3、准备好测试类

package text;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import spring.Player;

public class Test {
	public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "applicationContext.xml" });
 
        Player c = (Player) context.getBean("s");
         
        System.out.println(c.getName() + " " + c.getPosition());
    }
}

没问题:

 1、来个队伍类

public class Team {
    private String teamname;
    private String game;

    public String getTeamname() {
        return teamname;
    }

    public void setTeamname(String teamname) {
        this.teamname = teamname;
    }

    public String getGame() {
        return game;
    }

    public void setGame(String game) {
        this.game = game;
    }
}

 2、配置文件作出相应修改,写一个能创建Team类的bean并在创建Player类的bean中调动他

<?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:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/aop
   http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
   http://www.springframework.org/schema/tx
   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
   http://www.springframework.org/schema/context     
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">
  
	<bean name="s" class="spring.Player">
	   <property name="name" value="niko" />
	   <property name="position" value="步枪手" />
	   <property name="team" ref="t" />
	</bean>
	<bean name="t" class="spring.Team">
	   <property name="teamname" value="G2" />
	   <property name="game" value="csgo" />
	</bean>

  
</beans>

3、测试类

package text;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import spring.Player;

public class Test {
	public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "applicationContext.xml" });
 
        Player c = (Player) context.getBean("s");
         
        System.out.println(c.getName() + " " + c.getPosition() + " " + c.getTeam().getTeamname() + " " + c.getTeam().getGame());
    }
}

没问题

 1、修改配置文件

<?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:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/aop
   http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
   http://www.springframework.org/schema/tx
   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
   http://www.springframework.org/schema/context     
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">
  	
  	<context:annotation-config/>
	<bean name="s" class="spring.Player">
	   <property name="name" value="niko" />
	   <property name="position" value="步枪手" />
	</bean>
	<bean name="t" class="spring.Team">
	   <property name="teamname" value="G2" />
	   <property name="game" value="csgo" />
	</bean>

  
</beans>

2、为player加上注解

package spring;

import org.springframework.beans.factory.annotation.Autowired;

public class Player {
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    private int id;
    private String name;
    private String position;

    public Team getTeam() {
        return team;
    }

    public void setTeam(Team team) {
        this.team = team;
    }
    @Autowired
    private Team team;
}

 没问题

 试试对bean的注解:

1、修改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:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/aop
   http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
   http://www.springframework.org/schema/tx
   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
   http://www.springframework.org/schema/context     
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">
  	
  	<context:component-scan base-package="spring"/>

  
</beans>

 2、添加相关注释

package spring;

import org.springframework.stereotype.Component;

@Component("T")
public class Team {
    private String teamname = "navi";
    private String game = "csgo";

    public String getTeamname() {
        return teamname;
    }

    public void setTeamname(String teamname) {
        this.teamname = teamname;
    }

    public String getGame() {
        return game;
    }

    public void setGame(String game) {
        this.game = game;
    }
}

package spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("P")
public class Player {
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    private int id;
    private String name = "s1mple";
    private String position = "狙击手";

    public Team getTeam() {
        return team;
    }

    public void setTeam(Team team) {
        this.team = team;
    }
    @Autowired
    private Team team;
}

 没毛病:

2、教材练习 

setter注入之前已经用过,现在试试构造器注入

1、给team类加个带参构造方法

package spring;

import org.springframework.stereotype.Component;

public class Team {
    private String teamname;
    private String game;
    
    public Team(String teamname ,String game){
    	this.teamname = teamname;
    	this.game = game;
    }
    
    public String getTeamname() {
        return teamname;
    }

    public void setTeamname(String teamname) {
        this.teamname = teamname;
    }

    public String getGame() {
        return game;
    }

    public void setGame(String game) {
        this.game = game;
    }
}

 2、创建相应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:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/aop
   http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
   http://www.springframework.org/schema/tx
   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
   http://www.springframework.org/schema/context     
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">
  	
  	<bean name="t" class="spring.Team">
  		<constructor-arg>
  			<value>faze</value>
  		</constructor-arg>
  		<constructor-arg>
  			<value>csgo</value>
  		</constructor-arg>
  	</bean>

  
</beans>

3、测试类

package text;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import spring.Player;
import spring.Team;

public class Test {
	public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "applicationContext.xml" });
 
        Team c = (Team) context.getBean("t");
         
        System.out.println(c.getTeamname() + " " + c.getGame());
    }
}

 没毛病

接下来我们试试教材dao模式操作

 1、类还是用我们之前的Player类

package spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

public class Player {
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    private int id;
    private String name;
    private String position;

}

 2、来一个接口,这个接口可以不止抽象定义一种方法,后面可以按照需求定义多个方法,在这里只是尝试一个方法。

package impl;

import spring.Player;

public interface Playerdaoimpl {
	public void inserplayer(Player p);
}

3、定义一个dao类。这里用到了try。。。finally异常处理方法,这种方式简单来说就是尝试try中的代码,不管是否成功,最终都要执行finally中的代码

package dao;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import javax.sql.DataSource;

import impl.Playerdaoimpl;
import spring.Player;

public class Playerdao implements Playerdaoimpl{
	private DataSource dataSource;//注入DataSource
    public DataSource getDataSource() {
        return dataSource;
    }
    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
    }
    public void inserplayer(Player p){
    	String name = p.getName();
    	String position = p.getPosition();
    	Connection conn = null;
        Statement stmt = null;
        try {
            conn = dataSource.getConnection();//获取数据库连接
            stmt = conn.createStatement();
            stmt.execute("insert into player (name,position) " 
                 + "values('"+name+"','" + position + "')");
        } catch (SQLException e) {
            e.printStackTrace();
        }
        finally {
            if(stmt != null) {
                try {
                    stmt.close();//关闭Statement对象
                }   
                catch(SQLException e) {
                    e.printStackTrace();
                }
            }
            if(conn != null) {
                try {
                    conn.close();//关闭数据库连接
                }
                catch(SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

4、配置文件,注意对应好自己的数据库相关信息

<?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-2.5.xsd">
	<!-- 配置数据源 -->
	<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName">
			<value>com.mysql.jdbc.Driver</value>
		</property>
		<property name="url">
			<value>jdbc:mysql://localhost:3306/test
			</value>
		</property>
		<property name="username">
			<value>root</value>
		</property>
		<property name="password">
			<value>123456</value>
		</property>
	</bean>
	<bean id="userDAO" class="com.mr.dao.UserDAO">
		<property name="dataSource">
			<ref local="dataSource"/>
		</property>
	</bean>
</beans>

 5、创建好相应的数据库

CREATE TABLE player (
    id INT NOT NULL AUTO_INCREMENT,
    name VARCHAR(50) NOT NULL,
		position VARCHAR(50),
    PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

6、创建测试类

package text;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import dao.Playerdao;
import spring.Player;

public class Test {
	public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "applicationContext.xml" });
 
        Player p = new Player("simple" ,"狙击手");
        Playerdao dao = (Playerdao) context.getBean("playerdao");
        dao.inserplayer(p);
        System.out.println("成功");
    }
}

报了个错,是字符编码问题

java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
	at com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2412)
	at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
	at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
	at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
	at java.sql.DriverManager.getConnection(DriverManager.java:664)
	at java.sql.DriverManager.getConnection(DriverManager.java:208)
	at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173)
	at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:164)
	at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149)
	at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119)
	at dao.Playerdao.inserplayer(Playerdao.java:26)
	at text.Test.main(Test.java:15)

 我们修改xml文件中url为

<property name="url">
    		<value>jdbc:mysql://localhost:3306/how2java?useUnicode=true&amp;characterEncoding=UTF-8</value>
		</property>

再次运行,没问题

 最后用用JdbcTemple:

1、配置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-2.5.xsd">
	<!-- 配置数据源 -->
	<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="url">
    		<value>jdbc:mysql://localhost:3306/how2java?useUnicode=true&amp;characterEncoding=UTF-8</value>
		</property>
		<property name="username">
			<value>root</value>
		</property>
		<property name="password">
			<value>123456</value>
		</property>
	</bean>
	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
		<property name="dataSource">
			<ref local="dataSource"/>
		</property>
	</bean>
</beans>

package text;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;

import dao.Playerdao;
import spring.Player;

public class Test {
	public static void main(String[] args) {
		JdbcTemplate jtl = null;
        ApplicationContext factory = new ClassPathXmlApplicationContext("applicationContext.xml");//获取配置文件
        jtl =(JdbcTemplate)factory.getBean("jdbcTemplate");
        String sql = "insert into player(name,position) values ('niko' ,'步枪手')";
        jtl.update(sql);
        System.out.println("添加操作执行成功");
    }
}

没问题

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

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

相关文章

自学软件测试怎么学?新增软件测试(全栈),笔试及面试全套方法

既然是自学&#xff0c;那就如下方面着手吧。 1、面试(此篇文章的重磅) 2、思路 3、心态 4、技能 真所谓&#xff0c;“面试造飞机&#xff0c;工作拧螺丝”。咱们先从第一个&#xff0c;面试着手&#xff0c;这就好比写文章先列好提纲一样&#xff0c;要知道你这个行业具体有那…

【大学物理实验】绪论

《大学物理实验》实验报告册的封面&#xff0c;以下说法不正确的是&#xff1a; A. 应正确填写完整的学号 B. 预习前应写好姓名等相关信息 C. 报告册左上角应填写本班级报告箱编号 D. 除了姓名&#xff0c;其他信息可写可不写 正确答案&#xff1a; D 某同学完成某个实验&…

javascript基础四:== 和 ===区别,分别在什么情况使用?

一、等于操作符 等于操作符用两个等于号&#xff08; &#xff09;表示&#xff0c;如果操作数相等&#xff0c;则会返回 true 前面文章&#xff0c;我们提到在JavaScript中存在隐式转换。等于操作符&#xff08;&#xff09;在比较中会先进行类型转换&#xff0c;再确定操作…

Redis集群安装之哨兵集群

1.哨兵集群介绍及原理 主从模式&#xff0c;当主节点宕机之后&#xff0c;从节点是可以作为主节点顶上来&#xff0c;继续提供服务的。但是有一个问题&#xff0c;主节点的IP已经变动了&#xff0c;此时应用服务还是拿着原主节点的地址去访问&#xff0c;此时就需要人工干预进行…

阿里巴巴 MySQL binlog 增量订阅消费组件canal实现mysql数据同步

canal实现mysql数据同步 简介&#xff1a;最近线上系统进行压测&#xff0c;评估线上系统容量&#xff0c;根据压测情况对代理层&#xff0c;代码&#xff0c;sql等都做了相应的优化&#xff0c;而系统最大的瓶颈在于数据库&#xff0c;根据实际业务情况&#xff0c;决定对数据…

迅镭激光董事长颜章健受邀参加江苏师范大学研究生毕业答辩活动

5月20日&#xff0c;迅镭激光董事长颜章健应邀赴江苏师范大学物电学院进行为期2天的考察交流&#xff0c;并作为特聘专家参加光电信息工程专业研究生毕业答辩活动。 校企携手 再谱新篇 考察期间&#xff0c;江苏师范大学物电学院举行欢迎座谈会&#xff0c;江苏师范大学学科办…

二叉搜索树(查找、插入、删除的讲解实现+图文并茂)

目录 1. 二叉搜索树&#xff08;BST&#xff09; 1.1 二叉搜索树概念 1.2 二叉搜索树操作 1.2.1 二叉搜索树的查找 1.2.2 二叉搜索树的插入 1.2.3 二叉搜索树的删除 2. 二叉搜索树的实现 2.1BST基本结构 2.2 BST操作成员函数(非递归&#xff09; 2.3 BST操作成员函数&#x…

开放式耳机是什么意思?2023年开放式耳机推荐指南

开放式耳机&#xff0c;就是开放耳朵不需要塞入耳道的一种耳机。 这种耳机包括气传导和骨传导两种类型。气传导耳机采用波束成形技术进行定向传音&#xff0c;将音频传送到耳朵&#xff0c;其所采用的空气传导原理在发声的时候不会引起振动。 而骨传导耳机则是通过震动颅骨来…

HttpRunnerManager接口自动化测试框架在win环境下搭建教程

近几日一直在研究如何把接口自动化做的顺畅&#xff0c;目前用的是轻量级jmeterantJenkins自动化测试框架&#xff0c;目前测试界的主流是python语言&#xff0c;所以一直想用搭建一个基于python的HttpRunnerManager。公司项目也比较多&#xff0c;在上班的过程中偶尔研究了一下…

【Linux高级 I/O(6)】初识文件锁—— flock()方法(附代码示例)

想象一下&#xff0c;当两个人同时编辑磁盘中同一份文件时&#xff0c;其后果将会如何呢&#xff1f;在 Linux 系统中&#xff0c;该文件的最后状态通常取决于写该文件的最后一个进程。多个进程同时操作同一文件&#xff0c;很容易导致文件中的数据发生混乱&#xff0c;因为多个…

【UE】制作追踪导弹

效果 步骤 1. 首先在虚幻商城下载所需素材 2. 打开“BP_West_Missile_M26” 勾选模拟物理 添加一个变量&#xff0c;命名为“Target” 该变量用来表示导弹追踪的目标&#xff0c;变量类型为actor的对象引用&#xff0c;勾选可编辑实例和生成时公开 在事件图表中添加如下节点 3…

Swin Transformer 论文精读

Swin Transformer 论文精读 https://www.bilibili.com/video/BV13L4y1475U Swin 几乎涵盖了 CV 的下游任务&#xff08;下游任务指骨干网后面的 head 解决的任务&#xff0c;如&#xff1a;分类、检测、语义分割&#xff09;&#xff0c;并且曾经刷新多个数据集的榜单。 题目…

记一次符合Google Coding Style的Bash脚本重构

最近我在思考这样一个问题&#xff0c;顺便看一下gpt对这个问题的解释。搜索发现&#xff1a; 团队写代码&#xff0c;为什么要遵循coding guideline&#xff1f; 一致性&#xff1a;编码准则确保整个团队的代码风格和格式是一致的&#xff0c;这使得团队成员之间更易于交流和…

人工智能(Pytorch)搭建模型6-使用Pytorch搭建卷积神经网络ResNet模型

大家好&#xff0c;我是微学AI&#xff0c;今天给大家介绍一下人工智能(Pytorch)搭建模型6-使用Pytorch搭建卷积神经网络ResNet模型&#xff0c;在本文中&#xff0c;我们将学习如何使用PyTorch搭建卷积神经网络ResNet模型&#xff0c;并在生成的假数据上进行训练和测试。本文将…

Linux---vi/vim编辑器、查阅命令

1. vi\vim编辑器三种模式 vim 是 vi 的加强版本&#xff0c;兼容 vi 的所有指令&#xff0c;不仅能编辑文本&#xff0c;而且还具有 shell 程序编辑的功能&#xff0c; 可以不同颜色的字体来辨别语法的正确性&#xff0c;极大方便了程序的设计和编辑性。 命令模式&#xff08…

整数智能重磅推出集成SAM的智能标注工具2.0

前言 图像语义分割一直是数据标注中最繁琐、最耗时的标注任务之一&#xff0c;利用钢笔工具手动描边的标注方式所带来的时间成本和低准确率都将影响模型的生产速度和模型性能。整数智能ABAVA数据工程平台最新发布了基于SAM&#xff08;Segement Anything Model&#xff09;改进…

【面试题】面试题总结

加油加油 文章目录 1. TCP与UDP的区别2. TCP为什么是四次挥手机制3. HTTP与HTTPS的区别4. HTTPS加密机制5. 简要介绍SSL/TSL协议6. GET与POST的区别7. cookie与session的区别8. JVM内存区域划分9. 程序运行时候内存不足&#xff0c;会出现什么状况10. 显式调用GC会立即执行吗11…

【Python json】零基础也能轻松掌握的学习路线与参考资料

Python中的JSON模块主要用于将Python对象序列化成JSON数据或解析包含JSON数据的字符串。JSON&#xff08;JavaScript Object Notation&#xff09;是一种轻量级的数据交换格式&#xff0c;易于人阅读和编写&#xff0c;同时也易于机器解析和生成。由于JSON在Web应用中的广泛使用…

SpringCloud Sentinel实战限流熔断降级应用

目录 1 Sentinel核心库1.1 Sentinel介绍1.2 Sentinel核心功能1.2.1 流量控制1.2.2 熔断降级 2 Sentinel 限流熔断降级2.1 SentinelResource定义资源2.2 Sentinel的规则2.2.1 流量控制规则 (FlowRule)2.2.2 熔断降级规则 (DegradeRule)2.2.3 系统保护规则 (SystemRule)2.2.4 访问…

Tomcat配置https协议证书-阿里云,Nginx配置https协议证书-阿里云,Tomcat配置https证书pfx转jks

Tomcat/Nginx配置https协议证书 前言Tomcat配置https协议证书-阿里云方式一 pfx配置证书重启即可 方式二 jkspfx生成jks配置证书重启即可 Nginx配置https协议证书-阿里云实现方式重启即可 其他Tomcat相关配置例子如下nginx配置相关例子如下 前言 阿里云官网&#xff1a;https:…