springboot2 springboot spring3 spring
Swagger系列:SpringBoot3.x中使用Knife4j
目录一、简介二、版本说明三、使用四、效果图 一、简介 官网:https://doc.xiaominfo.com/ Knife4j是一个集Swagger2 和 OpenAPI3 为一体的增强解决方案 Knife4j 是为 Java MVC 框架集成 Swagger 生成 Api 文档的增强解决方案,前 ......
Spring源码解析——事务的回滚和提交
正文 上一篇文章讲解了获取事务,并且通过获取的connection设置只读、隔离级别等,这篇文章讲解剩下的事务的回滚和提交。最全面的Java面试网站 回滚处理 之前已经完成了目标方法运行前的事务准备工作,而这些准备工作最大的目的无非是对于程序没有按照我们期待的那样进行,也就是出现特定的错误,那么,当 ......
GraalVM进行spring boot的native编译报错 “returned non-zero result”解决方法
使用GraalVM对spring boot工程进行native编译: 系统:Centos JDK:GraalVM JDK 21 报错: If you are unable to resolve this problem, please file an issue with the error rep ......
SpringBoot 04 shiro数据认证及登录
实体类 @Data @AllArgsConstructor @NoArgsConstructor @TableName("t_user") public class RUser { @TableId(value="usr_id",type = IdType.AUTO) private Integer ......
springboot中easyExcel实现导入导出
导出1、引入easyExcel依赖<dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel</artifactId> <version>2.2.7</version></dependency>123452、实体类import ......
Spring MVC,Mybatis常见问题
如果您面试一个只做过Spring MVC+MyBatis项目的候选人,您可能会问一些问题来评估其在这两个技术上的了解和经验。以下是一些可能的问题及其答案: 什么是Spring MVC和MyBatis?它们在项目中的作用是什么? 答:Spring MVC是一个基于Spring框架的用于构建Web应用程 ......
springboot 打 war 包后的访问路径
http://laremehpe.eu.org:9090/api/access/time 域名:http://laremehpe.eu.org 端口号:9090 访问路径:/api/access/time /api 是tomcat解压后文件夹名称 /access 是类上的路径名称(@RequestM ......
spring 构造器注入
<bean id="s" class="cn.lexed.pojo.Student"> <constructor-arg name="name" value="Tom"></constructor-arg> <constructor-arg name="age" value="20"></const ......
spring setter注入
<!-- 对象类型 1--> <property name="user"> <props> <prop key="">dddd</prop> </props> </property> <!-- 对象类型 2--> <property name="user" ref="stu"> <!-- <bean ......
SpringBoot 注解小记
用于入口类的注解 SpringBootApplication标识该类是入口 ComponentScan表示扫描入口类同级和所有子包下的Component 我们也可以使用ComponentScan("Com.XXXX")自定义扫描路径 用于类的注解 @Component, @Service, @Rep ......
基于SpringBoot+Netty实现即时通讯(IM)功能
简单记录一下实现的整体框架,具体细节在实际生产中再细化就可以了。 第一步 引入netty依赖 SpringBoot的其他必要的依赖像Mybatis、Lombok这些都是老生常谈了 就不在这里放了 <dependency> <groupId>io.netty</groupId> <artifactId ......
SpringBoot限制接口访问频率
功能说明 可以通过注解快速实现类似一段时间内仅可以搜索N次,或一段时间内只能点赞N次,以及一段时间内尝试登陆多次即被禁止一小时等类似功能。 github地址 中文文档 第一步:添加Maven依赖 <dependency> <groupId>io.github.liuye744</groupId> < ......
Spring —— AOP
AOP有两种实现方式:静态代理和动态代理。 静态代理:代理类在编译阶段生成,在编译阶段将通知织入Java字节码中,也称编译时增强。AspectJ使用的是静态代理。 缺点:代理对象需要与目标对象实现一样的接口,并且实现接口的方法,会有冗余代码。同时,一旦接口增加方法,目标对象与代理对象都要维护。 动态 ......
Java(Spring) 通过反射classforName获取对象实例导致@Autowired注入失效
使用策略模式 多态获取具体的策略 问题描述:classforName在代码中使用反射获取对象实例后,对象实例中通过@Autowrite注解注入的属性值为null(注入失败),导致带反射获取的对象实例调用方法时出现空指针等情况。问题原因:通过反射获取对象实例相当于“new”了一个对象,所以这个对象并没 ......
Plugin 'org.springframework.boot:spring-boot-maven-plugin:' not found
Plugin 'org.springframework.boot:spring-boot-maven-plugin:' not found 一、问题现象 pom.xml 文件中有报红的错误提示,“Plugin 'org.springframework.boot:spring-boot-maven-p ......
springboot连接rabbitmq网络异常时,不能自动重连的问题
在rabbitmq官网的java api处:https://www.rabbitmq.com/api-guide.html#recovery介绍了java连接rabbitmq异常恢复的问题。其中提及了如下内容 As of version 4.0.0 of the Java client, autom ......
SpringBoot 缓存之 @Cacheable 详细介绍
简介缓存介绍Spring 从 3.1 开始就引入了对 Cache 的支持。定义了 org.springframework.cache.Cache 和 org.springframework.cache.CacheManager 接口来统一不同的缓存技术。并支持使用 JCache(JSR-107)注解 ......
Springboot实现模糊查询
合理怀疑我之前的脑子长歪了,就跟个小丑一样,到处蹦跶,也没解决,现在好像走了大运,就直接出结果了 具体实现 我跟之前的sql语句进行对比,发现在我印象里面我使用的是这种结构: select * from user where id like caoncat('%',#{id},'%'); 但是记忆好 ......
Spring Boot + K8S 中的滚动发布、优雅停机、弹性伸缩、应用监控、配置分离
前言 K8s + SpringBoot实现零宕机发布:健康检查+滚动更新+优雅停机+弹性伸缩+Prometheus监控+配置分离(镜像复用) 配置 健康检查 健康检查类型:就绪探针(readiness)+ 存活探针(liveness) 探针类型:exec(进入容器执行脚本)、tcpSocket(探测 ......
springboot访问图片本地路径并映射成url
这几天很头疼,vue不读取图片,src已经动态绑定了,还是访问不到vue本地下图片,于是我就把图片地址改为springboot本地就成功了。 下面是参考博客;springboot访问图片本地路径并映射成url_springboot配置图片访问路径-CSDN博客 最后样式 ......
SpringBoot 操作 达梦数据库
SpringBoot 操作 达梦数据库 一、前提条件 本篇博客以访问本地达梦数据库(DM8)为基础进行演示。(前提:本地已经安装了 DM8 数据库!) 关于 Windows 安装达梦数据库,请参考博客:Windows 安装 达梦数据库 关于 Docker 安装达梦数据库,请参考博客:Docker 安 ......
SpringBoot2,Druid数据源常用配置
spring: datasource: druid: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/mybatis?serverTimeZone=UTC username: root pass ......
SpringBoot启动流程源码分析(2)
1、启动引导类 大部分时候,SpringBoot应用主要通过在引导类调用SpringApplication的静态run方法启动,同时将引导类注册为配置源。比如下面是一个SpringMVC的Web应用,引导类是WebMVCBootstrap,和命令行参数args作为SpringApplication静 ......
SpringBoot 03 Shiro
shiro是apache的一个开源框架,是一个权限管理的框架,实现认证、授权、加密、会话管理。 shiro优势举例 易用:相当于其他安全框架,shiro比较简单易用。 使用非常广泛,资料好找。 灵活:可以工作在很多环境 。 web支持:对web的支持好, 如thymeleaf标签支持。 支持:应用广 ......
SpringBoot 02 shiro框架查询用户权限与角色
实体类 @Data @AllArgsConstructor @NoArgsConstructor @TableName("t_user") public class RUser { @TableId(value="id",type = IdType.AUTO) private Integer usr ......
Spring Boot 配置 Undertow 容器
配置之前,您需要知道的是,Tomcat, Jetty, Undertow 作为三大主流 Servelt 容器,Undertow 的性能要优于前两者。 所以,我们推荐您使用 Undertow 容器。接下来,就我们看看如何在 Spring Boot 中快捷地集成 Undertow。 一、添加 Maven ......
spring Boot
https://www.cnblogs.com/hellokuangshen/tag SpringBoot系列 (12)kuangstudy (1)消息队列 (1)教程 (1)RabbitMQ (1)学相伴 (1)教学视频 (1)程序员 (1) ......
SpringBoot应用jar包启动原理详解
1、maven打包 Spring Boot项目的pom.xml文件中默认使用spring-boot-maven-plugin插件进行打包: <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifact ......
Spring源码分析系列——循环依赖解析(附详尽流程图)
前言 本文分析spring循环依赖,我们知道 构造函数填充属性是天然无法解决循环依赖的,而且解决循环依赖必须至少需要一个单例bean提前暴露。 用xml标签配置属性bean,和@autowire注解注入属性bean,注入属性过程是不一样的。 (1)xml标签配置属性bean是在解析xml过程中直接将 ......
Spring IOC/DI注解开发
1 注解开发定义bean //注解开发定义bean用的是2.5版提供的注解,使用注解代替bean标签。 (1) 删除原XML配置 //将配置文件中的<bean>标签删除掉。<bean id="bookDao" class="com.itheima.dao.impl.BookDaoImpl"/> (2 ......