Spring 围炉夜话

本文涉及的产品
云原生内存数据库 Tair,内存型 2GB
云数据库 Redis 版,标准版 2GB
推荐场景:
搭建游戏排行榜
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
简介: Spring 围炉夜话

工具

Wireshark的抓包和分析,看这篇就够了! - 知乎

Other Versions - WebStorm

Other Versions - IntelliJ IDEA

JetBrains下载历史版本(IDEA、PyCharm、WebStorm、PhpStorm等)_好奇的菜鸟的博客-CSDN博客_webstorm历史版本

POM

pom(Project Object Model),项目对象模型。通过xml可扩展标记语言(EXtensible Markup Language)格式保存的pom.xml文件。作用类似ant的build.xml文件,功能更强大。该文件用于管理:源代码、配置文件、开发者的信息和角色、问题追踪系统、组织信息、项目授权、项目的url、项目的依赖关系等等。

史上最全的 pom.xml 文件详解_雨雾清影的博客-CSDN博客_pom.xml

Maven中pom文件内scope标签中import值的详解 - 之之小侠 - 博客园

Spring Boot打jar包,排除lombok等scope=provided的依赖(转)_51CTO博客_spring boot打包没有引入依赖包

一个 pom.xml 示例:

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <!– The Basics –>
  <groupId>…</groupId>
  <artifactId>…</artifactId>
  <version>…</version>
  <packaging>…</packaging>
  <dependencies>…</dependencies>
  <parent>…</parent>
  <dependencyManagement>…</dependencyManagement>
  <modules>…</modules>
  <properties>…</properties>
  <!– Build Settings –>
  <build>…</build>
  <reporting>…</reporting>
  <!– More Project Information –>
  <name>…</name>
  <description>…</description>
  <url>…</url>
  <inceptionYear>…</inceptionYear>
  <licenses>…</licenses>
  <organization>…</organization>
  <developers>…</developers>
  <contributors>…</contributors>
  <!– Environment Settings –>
  <issueManagement>…</issueManagement>
  <ciManagement>…</ciManagement>
  <mailingLists>…</mailingLists>
  <scm>…</scm>
  <prerequisites>…</prerequisites>
  <repositories>…</repositories>
  <pluginRepositories>…</pluginRepositories>
  <distributionManagement>…</distributionManagement>
  <profiles>…</profiles>
</project>

超级详细的 Maven 教程(基础+高级)_Ayue、的博客-CSDN博客_maven

IDEA的Maven换源_idea切换源_夜未至的博客-CSDN博客

maven生命周期lifecycle和plugins介绍_跃马檀溪的博客-CSDN博客_maven plugins和lifecycle

maven生命周期lifecycle和plugins介绍_ximeneschen的博客-CSDN博客_lifecycle和plugins区别

使用Maven打包生成的-SNAPSHOT.jar与-RELEASE.jar分别代表什么?SNAPSHOT是什么意思?RELEASE是什么意思?_中冬廿九的博客-CSDN博客_snapshot.jar

maven:shade 生成快照版本(SNAPSHOT)的fat-jar,同时生成对应的source.jar_10km的博客-CSDN博客_maven 生成快照版本

Maven中的<distributionManagement>_她丶如月中来的博客-CSDN博客_distributionmanagement

AlibabaCloud 和 SpringCloud的区别+多机房部署-数据库复制延迟-解决方案_小滴课堂的博客-CSDN博客

Gradle

Spring Boot彻底抛弃Maven,正式转向Gradle,速度贼快!_xhmj12的博客-CSDN博客

Gradle和Maven仓库介绍

Groovy 快速入门_学姐敲代码的博客-CSDN博客_groovy入门

JAR

JAR包详解_清平乐的技术专栏的博客-CSDN博客_jar包

04 JAR 文件规范_LinQingYanga的博客-CSDN博客

spring-boot:repackage生成的MANIFEST.MF中的Main-Class和Start-Class - StarkBrothers - 博客园

从jar包中读取资源文件_六六的小帅的博客-CSDN博客_获取jar包中的资源文件

从jar包中读取文件的几种方式_wang0907的博客-CSDN博客_读取jar包内文件


注解

JAVA 注解的基本原理_Liuqz2009的博客-CSDN博客

Java基础 - @interface(注解)_MrDJun的博客-CSDN博客_@interface map

注解式控制器_Liuqz2009的博客-CSDN博客

Spring全部注解_立木南门,的博客-CSDN博客_spring注解

Spring注解详解_gelingxian的博客-CSDN博客_spring注解

关于@Autowired的这些新姿势,你学会了

Spring的三种注入方式详解_官方推荐构造器注入_-会飞的企鹅的博客-CSDN博客_spring 构造器注入

Java使用final构造器注入方式更安全_蜜桃先生的博客-CSDN博客_private final注入

spring final 加构造函数注入丶Java教程网-IT开发者们的技术天堂

Spring使用有参构造器创建对象autowireConstructor方法_萌新驾到的博客-CSDN博客_autoware 有参构造函数

深度分析Spring中的构造器注入_51CTO博客_spring构造器注入

SpringBoot读取配置的6种方式_springboot读取配置文件_白豆五的博客-CSDN博客


JNA

jna实现java链接动态库所形成的jar包,jar中的动态库动态加载的方法(也就是调用时只提供jar包即可运行)。jar包中拥有动态库依赖库的情况。_小深learn的博客-CSDN博客_jna.jar包

将动态库打包在Jar包并调用的方法_元澈的博客-CSDN博客

JNI便捷开发框架JNA框架之入门(一)_cy谭的博客-CSDN博客_jna

JNI便捷开发框架JNA框架之指针参数Pointer(二)_cy谭的博客-CSDN博客_jna pointer

JNI便捷开发框架JNA框架之引用传递ByReference(三)_cy谭的博客-CSDN博客_pointerbyreference类


Spring

idea指定启动参数${MYSQL-USER:root}_p_moriarty的博客-CSDN博客

http请求中的三种参数类型 - 小草小草随风飘摇 - 博客园

ConfigurationProperties注解详解_思维的深度的博客-CSDN博客_configurationproperties注解


SpringBoot

Spring Boot(二):开始第一个Spring Boot项目 - 知乎

Spring Boot 开始(官网文档翻译)_七号公园的忧伤的博客-CSDN博客_springboot 开始

Spring | Spring Quickstart Guide

Spring Cloud

mysql安装教程【安装版】_超级小的大西瓜的博客-CSDN博客_mysql安装教程

https://github.com/alibaba/spring-cloud-alibaba/wiki

Spring Cloud Alibaba 参考文档

nacos

Nacos搭建_wengiling的博客-CSDN博客_nacos搭建

如何快速搭建nacos服务_刺眼_的博客-CSDN博客_nacos创建服务

nacos集群搭建详细教程_听者vae的博客-CSDN博客_nacos集群搭建

FAQ 【nacos常见问题】

Nacos支持三种部署模式

Nacos 快速开始【官网单机部署】

集群部署说明 【官网集群部署】

1.Nacos安装和部署(单机和集群模式)_zyplanke的博客-CSDN博客_单机部署nacos集群 【补充创建用户名和数据库】

Nacos 注册中心集群搭建 - 路仁甲 - 博客园  【集群nacos 客户端注册多IP写法】

SpringCloud 之 consul_tengxvincent的博客-CSDN博客_spring.cloud.consul

Nacos Config

Spring Cloud系列之Spring Cloud Config_做时间的朋友。的博客-CSDN博客_spring cloud config

SpringCloud之Config配置中心_桐花思雨的博客-CSDN博客_spring cloud config

SpringCloud之Config配置中心_桐花思雨的博客-CSDN博客_spring cloud config

SpringCloud启动的时候会自动拉取服务端的配置

Nacos Config--服务配置_wmburst的博客-CSDN博客_nacos-config

Nacos Config 服务配置中心_陈家宝的博客-CSDN博客_nacos配置config

Springcloud Nacos Config 配置服务管理中心 - 哔哩哔哩

spring cloud 引入nacos config配置不生效_sushuiyuzhou的博客-CSDN博客_nacos修改配置后不生效

高版本springcloud导致nacos 配置不生效问题_凌涑的博客-CSDN博客_springcloud nacos配置不生效

spring.cloud.nacos.config.file-extension=yml

spring.cloud.nacos.config.file-extension不指定,则配置文件后缀默认为properties,否则为指定的后缀。

服务器上配置文件可以省略后缀,或者加上后缀

负载均衡

RestTemplate_不爱吃胡萝卜的阿丁的博客-CSDN博客_resttemplate

@SentinelRestTemplate使用_雪峰.贵的博客-CSDN博客

Ribbon和Feign的区别? - 咔啡 - 博客园

Spring Cloud Gateway

SpringCloud Gateway用法详解_无敌小田田的博客-CSDN博客_spring cloud gateway

Springcloud gateway (史上最全)_架构师-尼恩的博客-CSDN博客_spring cloud gateway

Nacos+Spring Cloud Gateway动态路由配置实现步骤_Java教程_服务器之家

Spring Cloud Gateway

sentinel

Hystrix和Sentinel对比,如何选择_Leo Han的博客-CSDN博客_hystrix和sentinel对比

Spring Cloud Alibaba Sentinel 初体验_索码理的博客-CSDN博客

Spring Cloud Alibaba Sentinel 整合 nacos 进行规则持久化_索码理的博客-CSDN博客_sentinel 整合nacos

MQ

RabbitMQ 和 RocketMQ 区别与选型_hgdzw的博客-CSDN博客_rabbitmq和rocketmq区别

【转载】RocketMQ和RabbitMQ的特性及区别_牧子与羊的博客-CSDN博客_rocketmq rabbitmq区别

快速开始 | RocketMQ

SpringCloud集成RocketMQ_inthirties的博客-CSDN博客_springcloud集成rocketmq

springcloud集成rocketMQ_@进行中的博客-CSDN博客_springcloud集成rocketmq

Seata

spring-cloud-alibaba/readme-zh.md at 2021.x · alibaba/spring-cloud-alibaba · GitHub

Seata 官网

GitHub - seata/seata-go: Go Implementation For Seata Seata Go项目

Seata 是什么  官网帮助文档

Spring Cloud集成seata_qq_32415191的博客-CSDN博客_springcloud集成seata

SpringCloud集成Seata_朽木要自雕的博客-CSDN博客_springcloud 集成seata

SpringCloud 整合 Seata_【非典型Coder】的博客-CSDN博客_seata springcloud


Spring Security & Spring Cloud Security

Spring Security 和 SpringCloud Security 有什么区别?_普通网友的博客-CSDN博客

cookie是什么意思-太平洋IT百科

cookie和session的详解与区别 - 测试开发喵 - 博客园

Token(计算机术语)_百度百科

什么是token

JWT详解_baobao555#的博客-CSDN博客_jwt

SpringSecurity(授权认证+JWT)_似梦的苏烟的博客-CSDN博客_springsecurity+jwt

Spring Security :: Spring Security

最新版微服务架构鉴权解决方案Spring Cloud Gateway + Oauth2.0+mybatis+mysql+redis+nacos 统一认证和鉴权_Dream_it_possible!的博客-CSDN博客


微服务常见认证、鉴权方案_科氏加速度的博客-CSDN博客_微服务鉴权

OAuth2.0 详解 - 知乎


实战

项目介绍 | youlai-mall

  1. Spring Cloud实战 | 第一篇:Windows搭建Nacos服务
  2. Spring Cloud实战 | 第二篇:Spring Cloud整合Nacos实现注册中心
  3. Spring Cloud实战 | 第三篇:Spring Cloud整合Nacos实现配置中心
  4. Spring Cloud实战 | 第四篇:Spring Cloud整合Gateway实现API网关
  5. Spring Cloud实战 | 第五篇:Spring Cloud整合OpenFeign实现微服务之间的调用
  6. Spring Cloud实战 | 第六篇:Spring Cloud Gateway+Spring Security OAuth2+JWT实现微服务统一认证授权
  7. Spring Cloud实战 | 最七篇:Spring Cloud Gateway+Spring Security OAuth2集成统一认证授权平台下实现注销使JWT失效方案
  8. Spring Cloud实战 | 最八篇:Spring Cloud +Spring Security OAuth2+ Vue前后端分离模式下无感知刷新实现JWT续期
  9. Spring Cloud实战 | 最九篇:Spring Security OAuth2认证服务器统一认证自定义异常处理
  10. Spring Cloud实战 | 第十篇 :Spring Cloud + Nacos整合Seata 1.4.1最新版本实现微服务架构中的分布式事务,进阶之路必须要迈过的槛
  11. Spring Cloud实战 | 第十一篇 :Spring Cloud Gateway网关实现对RESTful接口权限和按钮权限细粒度控制

redis下载与安装(windows版)_丑八怪223的博客-CSDN博客_redis下载

Install Docker Desktop on Ubuntu | Docker Documentation

docker Ubuntu 22.04下搭建环境

Linux知识_Liuqz2009的博客-CSDN博客

Docker

Docker安装 | youlai-mall

https://www.cnblogs.com/zengjianrong/p/16516075.html apt换ustc源

docker:更换镜像源_玩转测试开发的博客-CSDN博客_docker换源

Docker换源与镜像拉取_dockerpull拉取国内镜像_wxystyle的博客-CSDN博客

Ubuntu 安装和使用MySQL_奉君逍遥的博客-CSDN博客_ubuntu mysql

MySql

MySQL部署 | youlai-mall

Ubuntu 安装和使用MySQL_奉君逍遥的博客-CSDN博客_ubuntu mysql

Oauth2.0 数据库表_芊芊墨客的博客-CSDN博客_oauth2.0数据库表

Redis

Redis部署 | youlai-mall

Redis 设置密码_张童瑶的博客-CSDN博客_redis配置用户名密码

Redis中文网 Redis官网

Docker 安装 Redis 容器 (完整详细版)_Touch&的博客-CSDN博客_docker redis

docker run -d --name=redis  \
-p 6379:6379 \
-v /home/liuqz/learnSpring/docker/redis/conf/redis.conf:/etc/redis/redis.conf \
-v /home/liuqz/learnSpring/docker/redis/data:/data \
--restart=always \
redis:latest redis-server /etc/redis/redis.conf 

redis如何查看key的有效期_怎么又有bug单的博客-CSDN博客_redis查看key的过期时间

# Redis 查看所有的key
keys *
 
# redis如何查看key的有效期
ttl "keyname"
 
# Redis TTL命令用于获取键到期的剩余时间(秒)。
# 返回值是以毫秒为单位的整数值TTL或负值
# 负值代表该键值不存在或没有有效期,具体如下:
#   -1, 如果key没有到期超时。
#   -2, 如果键不存在。

RabbitMQ

RabbitMQ部署 | youlai-mall

docker run -d --name rabbitmq --restart always --hostname rabbitmq -p 15672:15672 -p 5672:5672 rabbitmq

Linux、window系统修改rabbitmq 默认端口及修改用户密码_Marco_R的技术博客_51CTO博客

Nacos

Nacos部署 | youlai-mall

Seata

Seata部署 | youlai-mall

实战2

有哪些使用Spring Cloud的完整微服务项目? - 知乎

前言 · 语雀 pig

lengleng (log4j) - Gitee.com

【pig-cloud项目】关于@Inner和@PreAuthorize的理解,以及微服务内外部间的调用认证鉴权理解_清晨敲代码的博客-CSDN博客_@inner

认证流程

SpringSecurity中有如下的过滤器:

pig 生成token (认证)详解 ⭐️ · 语雀

OAuth2ClientAuthenticationFilter

 
// OAuth2ClientAuthenticationFilter 
public final class OAuth2ClientAuthenticationFilter extends OncePerRequestFilter {
    // ...
    // authenticationConverter 为 DelegatingAuthenticationConverter 
    // 登录时带Authorization返回的是 ClientSecretBasicAuthenticationConverter
    // 登录成功后带jwt,返回的是 JwtClientAssertionAuthenticationConverter
    Authentication authenticationRequest = this.authenticationConverter.convert(request);
    Authentication authenticationResult = this.authenticationManager.authenticate(authenticationRequest);
    // ...
}
 
public final class DelegatingAuthenticationConverter implements AuthenticationConverter {
    // ...
    public Authentication convert(HttpServletRequest request) {
    Assert.notNull(request, "request cannot be null");
        // converters 有四个:
        // JwtClientAssertionAuthenticationConverter,处理JWT
        // ClientSecretBasicAuthenticationConverter,处理头部Authorization
        // ClientSecretPostAuthenticationConverter,处理参数client_id和client_secret
        // PublicClientAuthenticationConverter,PKCE,grant_type,code,code_verifier
    for (AuthenticationConverter converter : this.converters) {
      Authentication authentication = converter.convert(request);
      if (authentication != null) {
        return authentication;
      }
    }
    return null;
  }
}

通过AuthenticationConverter创建相应的Authentication,然后调用ProviderManager类进行进一步处理:

public class ProviderManager implements AuthenticationManager, MessageSourceAware, InitializingBean {
    // ...
    @Override
  public Authentication authenticate(Authentication authentication) throws AuthenticationException {
        // getProviders() 的值为:
        // AnonymousAuthenticationProvider
        // JwtClientAssertionAuthenticationProvider@19312
        // ClientSecretAuthenticationProvider@19402
        // PublicClientAuthenticationProvider@19406
        // OAuth2AuthorizationCodeRequestAuthenticationProvider@19407
        // ...
        for (AuthenticationProvider provider : getProviders()) {
            if (!provider.supports(toTest)) {
          continue;
        }
            result = provider.authenticate(authentication);
        if (result != null) {
          copyDetails(authentication, result);
          break;
        }
        }
    }
    // ...
}


getProviders()的值为:

OAuth2TokenEndpointFilter

public final class OAuth2TokenEndpointFilter extends OncePerRequestFilter {
    // ...
    @Override
  protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
      throws ServletException, IOException {
        Authentication authorizationGrantAuthentication = this.authenticationConverter.convert(request);
        OAuth2AccessTokenAuthenticationToken accessTokenAuthentication =
          (OAuth2AccessTokenAuthenticationToken) this.authenticationManager.authenticate(authorizationGrantAuthentication);
      this.authenticationSuccessHandler.onAuthenticationSuccess(request, response, accessTokenAuthentication);
    }
    // ...
}


补全

理解JDBC/JPA/Mybatis/Hibernate_~一叶、的博客-CSDN博客_jdbc jpa mybatis

5分钟彻底搞懂“OAuth2.0”协议

(一)关于spring security的简要介绍以及相关配置和jar包认识 - 走看看

解决请求跨域问题_chy1984的博客-CSDN博客_请求跨域问题

什么是跨域请求及如何实现 - 知乎

VUE

npm 安装详细教程_Cleve_baby的博客-CSDN博客_npm安装

超详细Vue Devtools的下载和安装——Vue的调试工具_沐小侠的博客-CSDN博客_vue开发者工具下载

vue-devtools的安装与使用_柒留心的博客-CSDN博客_vue devtools

Vue的开发常用的工具有哪些? - 知乎

VSCode 开发Vue必备插件 - zyp_java_net - 博客园

VsCode工具开发vue项目必装插件清单(推荐!)

【VsCode】VsCode(Vue/React)的安装与48个插件大全_敦厚的曹操的博客-CSDN博客_vscodevue插件

Springboot支持HTTPS教程(亲测有效)_Bug克星的博客-CSDN博客_springboot支持https


相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore &nbsp; &nbsp; ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库&nbsp;ECS 实例和一台目标数据库&nbsp;RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&amp;RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
相关文章
|
4月前
|
架构师 安全 前端开发
阿里P9架构师推荐的Spring领域巅峰之作,颠覆了我对Spring的认知
你第一次接触spring框架是在什么时候?相信很多人和我一样,第一次了解spring都不是做项目的时候用到,而是在网上看到或者是听到过一个叫做spring的框架,这个框架号称完爆之前的structs和structs2,吸引了不少人的注意。
|
21天前
|
前端开发 Java 开发者
Spring Boot DevTools 热部署神器,助你在开发浪潮中乘风破浪,一骑绝尘!
【8月更文挑战第29天】在快速迭代的软件开发领域,高效开发至关重要。Spring Boot DevTools 作为一款优秀的热部署工具,可自动重新加载代码修改,无需手动重启应用,大幅节省时间,即时预览修改效果,简化开发流程。通过简单示例,展示了其自动刷新静态资源和模板文件的功能,有效提升了开发效率,使开发者更专注于功能实现。它就像是开发者的得力助手,显著减少等待时间,带来更高效、流畅的开发体验。
29 0
|
存储 监控 数据可视化
外行人都能看得懂的Spring Cloud服务注册与发现,错过了血亏!
外行人都能看得懂的Spring Cloud服务注册与发现,错过了血亏!
|
安全 Java 数据库
弯道超车!阿里甩出Spring Security宝典我粉了
据有关数据表明Spring Security在Java应用安全领域已经慢慢成为首先被推崇的安全解决方案。虽然它在Java应用安全领域所占比重越来越大,但大多数开发者面对Spring Security这样的“庞然大物”时无从入手,也因为对其不够了解而在实际项目中不敢轻易采用。如何学?怎么把它引入到项目里?已经是每一个开发人员需要考虑的问题。
|
Prometheus Cloud Native Java
Spring Boot 3.0 要来了,真心强!
Spring Boot 3.0 要来了,真心强!
|
缓存 Prometheus 监控
非常哇塞的 Spring Boot 性能优化长文
非常哇塞的 Spring Boot 性能优化长文
|
运维 监控 前端开发
竟然开源,万人围观,spring-cloud详细解说
竟然开源,万人围观,spring-cloud详细解说
181 0
|
Java 关系型数据库 MySQL
Spring Boot 蓝天幼儿园管理系统,拿来练手真不错。。
Spring Boot 蓝天幼儿园管理系统,拿来练手真不错。。
369 0
Spring Boot 蓝天幼儿园管理系统,拿来练手真不错。。
|
缓存 Java Maven
spring中那些让你爱不释手的代码技巧(续集下)
spring中那些让你爱不释手的代码技巧(续集下)
spring中那些让你爱不释手的代码技巧(续集下)
|
XML 缓存 NoSQL
恐怖!这份神仙架构笔记,简直把所有spring boot的核心技术都写出来了!
自从 structs2 出现上次的漏洞以后,对 spring 的关注度开始越来越浓。以前 spring 开发需要配置一大堆的 xml,后台 spring 加入了 annotaion,使得 xml 配置简化了很多,当然还是有些配置需要使用 xml,比如申明 component scan 等。Spring 开了一个新的 model spring boot,主要思想是降低 spring 的入门,使得新手可以以最快的速度让程序在 spring 框架下跑起来。
199 0