avatar
文章
360
标签
49
分类
10
首页
时间轴
分类
关于
Logo只有那年胜过年年
搜索
首页
时间轴
分类
关于

只有那年胜过年年

Spring Boot 2.2.2 发布,新增 2 个新特性!
发表于2025-10-29|后端
Spring Boot 2.2.2 发布咯! Spring Boot 2.2.1 发布,一个有点坑的版本! 2.2.1 发布没过一个月,2.2.2 就来了。 Maven依赖给大家奉上: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot</artifactId> <version>2.2.2.RELEASE</version> </dependency> 这个版本都更新了啥? 新增了两个新特性1、支持在第三方类上的构造器参数绑定; 什么是构造器参数绑定?看下栈长之前写的这篇文章:Spring Boot 构造器参数绑定,越来越强大了! 2、支持 Gradle 6; 日常维护修复了 88 个bug、性能优化、依赖更新。 一大周末的起来更新文章,四季如夏的深圳,我却裹着棉大衣在这写文章,不可思议吧,今年的深圳似乎比以往要冷一些,或...
Spring Boot 2.x 与 1.x 的区别,以及如何做版本迁移
发表于2025-10-29|后端
这一篇文章主要讲解 Spring Boot 2.x 与 1.5.x 的区别,2.x 主要更新了什么东西,以便对 Spring Boot 2.x 有一个详细的了解。 本文讲的 1.x 指的是 1.5.10, 2.x 指的是 2.0.0。 配置变更 在 2.x 中废除了一些 1.x 中的配置,并增加了许多新配置,详细请查看以下链接中的变更表格。 https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Configuration-Changelog 依赖 JDK 版本升级 2.x 至少需要 JDK 8 的支持,2.x 里面的许多方法应用了 JDK 8 的许多高级新特性,所以你要升级到 2.0 版本,先确认你的应用必须兼容 JDK 8。 另外,2.x 开始了对 JDK 9 的支持。 第三方类库升级 2.x 对第三方类库升级了所有能升级的稳定版本,一些值得关注的类库升级我给列出来了。 Spring Framework 5+ Tomcat 8.5+ Flyway 5+ Hibernate...
Spring Boot 2.x 启动全过程源码分析(上)入口类剖析
发表于2025-10-29|后端
Spring Boot 的应用教程我们已经分享过很多了,今天来通过源码来分析下它的启动过程,探究下 Spring Boot 为什么这么简便的奥秘。 本篇基于 Spring Boot 2.0.3 版本进行分析,阅读本文需要有一些 Java 和 Spring 框架基础,如果还不知道 Spring Boot 是什么,建议先看下我们的 Spring Boot 教程。 Spring Boot 的入口类@SpringBootApplication public class SpringBootBestPracticeApplication { public static void main(String[] args) { SpringApplication.run(SpringBootBestPracticeApplication.class, args); } } 做过 Spring Boot 项目的都知道,上面是 Spring Boot 最简单通用的入口类。入口类的要求是最顶层包下面第一个含有 main 方法的类,使用注解 @Sp...
Spring Cloud 如何动态刷新 Git 仓库配置?
发表于2025-10-29|后端
有时候在配置中心有些参数是需要修改的,这时候如何不重启而达到实时生效的效果呢? 本文基于以下讲解: Spring Cloud Greenwich.SR3 Spring Boot 2.1.7.RELEASE 基于 Git 的配置中心仓库 添加 actuator 依赖在引用配置中心的项目中添加以下 actuator 依赖: <dependencies> ... <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> ... </dependencies> spring-boot-starter-actuator:这个模块的 /actuator/refresh (POST请求)端点可以刷新配置,更多的使用参考 Spring Boot...
Spring Boot 2.x 启动全过程源码分析(下)运行方法剖析
发表于2025-10-29|后端
上篇《Spring Boot 2.x 启动全过程源码分析(一)入口类剖析》我们分析了 Spring Boot 入口类 SpringApplication 的源码,并知道了其构造原理,这篇我们继续往下面分析其核心 run 方法。 [toc] SpringApplication 实例 run 方法运行过程 上面分析了 SpringApplication 实例对象构造方法初始化过程,下面继续来看下这个 SpringApplication 对象的 run 方法的源码和运行流程。 public ConfigurableApplicationContext run(String... args) { // 1、创建并启动计时监控类 StopWatch stopWatch = new StopWatch(); stopWatch.start(); // 2、初始化应用上下文和异常报告集合 ConfigurableApplicationContext context = null; Collection&...
Spring Boot Profile 配置详解
发表于2025-10-29|后端
Profile是什么Profile我也找不出合适的中文来定义,简单来说,Profile就是Spring Boot可以对不同环境或者指令来读取不同的配置文件。 Profile使用假如有开发、测试、生产三个不同的环境,需要定义三个不同环境下的配置。 基于properties文件类型你可以另外建立3个环境下的配置文件: applcation.propertiesapplication-dev.propertiesapplication-test.propertiesapplication-prod.properties 然后在applcation.properties文件中指定当前的环境:spring.profiles.active=test这时候读取的就是application-test.properties文件。 基于yml文件类型只需要一个applcation.yml文件就能搞定,推荐此方式。 spring: profiles: active: prod --- spring: profiles: dev server: port:...
Spring Boot Debug调试,日后必定有用
发表于2025-10-29|后端
最近发现 Spring Boot 本地不能 Debug 调试了,原来 Spring Boot 升级后,对应插件的命令参数都变了,故本文做一个升级。 背景: Spring Boot 项目在使用 Spring Boot Maven 插件执行启动命令 spring-boot:run 的时候,如果设置的断点进不去,要进行以下的设置。 官方解决方案: By default, the run goal runs your application in a forked process. If you need to debug it, you should add the necessary JVM arguments to enable remote debugging. The following configuration suspend the process until a debugger has joined on port 5005: 直接看怎么做吧! 1、添加 JVM 参数在插件 spring-boot-maven-plugin 里面加上 jvmArguments 配置...
Spring Boot Server容器配置
发表于2025-10-29|后端
参数配置容器server.xx开头的是所有servlet容器通用的配置,server.tomcat.xx开头的是tomcat特有的参数,其它类似。 所有参数绑定配置类:org.springframework.boot.autoconfigure.web.ServerProperties 代码配置容器除了利用上面的参数来自动配置servlet容器,还可以通过代码的方式。可以直接实现EmbeddedServletContainerCustomizer这个接口,ServerProperties也是实现这个接口的。 @ConfigurationProperties(prefix = "server", ignoreUnknownFields = true) public class ServerProperties implements EmbeddedServletContainerCustomizer, EnvironmentAware, Ordered { ... 当然如果是Tomcat、Jetty、Undertow也可以使...
Spring Boot YML 掀翻 Properties
发表于2025-10-29|后端
.properties 配置文件大家应该都很熟悉,键值对嘛,.yml 配置文件栈长也是从 Spring Boot 开始了解到的。 那么,这两种格式的配置文件到底有哪些区别呢?哪个更好?能不能替换代替?今天,栈长就来解开这些谜团,看 YML 能不能掀翻Properties。。。 .properties格式: spring.application.name=register-center spring.security.user.name=javastack spring.security.user.password=javastack .yml格式: spring: application: name: register-center security: user: name: javastack password: javastack 如上所示,.properties 是键值对形式,.yml 是树状结构的,配置更方便,可以直接写中文,阅读也可友好。 这还不算什么,yml最强大的是能节省很多配置,如下...
Spring Boot Runner启动器
发表于2025-10-29|后端
Runner启动器如果你想在Spring Boot启动的时候运行一些特定的代码,你可以实现接口ApplicationRunner或者CommandLineRunner,这两个接口实现方式一样,它们都只提供了一个run方法。 CommandLineRunner:启动获取命令行参数。 public interface CommandLineRunner { /** * Callback used to run the bean. * @param args incoming main method arguments * @throws Exception on error */ void run(String... args) throws Exception; } ApplicationRunner:启动获取应用启动的时候参数。 public interface ApplicationRunner { /** * Callback used to run the bean. * @p...
1…202122…36
avatar
2025
文章
360
标签
49
分类
10
公告
🌸 春去秋来,花开花落 📚 桌上的日历又薄了几页 💭 记忆中的昨天还那么清晰
最新文章
掌握 Spring 框架这 10 个扩展点,开发效率直接翻倍2025-11-10
Minikube安装教程2025-11-07
Deepseek 本地部署各个版本超级详细教学,网页版、软件版2025-11-04
Slow HTTP POST 慢速攻击2025-10-30
JDK 紧急漏洞,XMLDecoder反序列化攻击2025-10-30
分类
  • 其他3
  • 区块链4
  • 后端225
  • 安全漏洞3
  • 工具30
  • 性能4
  • 教程1
  • 数据库21
  • 架构15
  • 程序人生54
标签
文章LinuxJVM分布式技术其他区块链基础安全漏洞多线程性能优化新特性架构算法程序人生行业动态规范资料集合进阶面试Elastic JobdockerJWTDubboMyBatisNettyShiroSpringSpring MVCSpring CloudTomcatSpring BootZookeeper日志开源综合技术消息队列缓存连接池Eclipse
归档
  • 2025年11月 3
  • 2025年10月 355
  • 2025年09月 1
  • 2024年12月 1
网站信息
文章数目 :
360
本站访客数 :
本站总浏览量 :
最后更新时间 :
访客地图
© 2025 By 2025
搜索
数据加载中