SpringBoot
文章平均质量分 90
nklinsirui
DevOps的实践者和布道者。
中国DevOps社区特邀讲师。
现在某国际开源软件公司担任高级专家顾问、开放创新实验室架构师。
曾在某电子政务公司担任高级系统架构师、公司技术委员会常设专家组成员。
曾在某国际咨询公司担任技术架构交付经理。
曾在某跨国银行中国软件开发中心担任高级专家顾问。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Spring Boot Kafka - 用Multi-Consumer应对高吞吐量
文章目录Spring Boot Kafka - 用Multi-Consumer应对高吞吐量前言主题与分区低吞吐量场景高吞吐量场景增加Topic的分区数使用Multi Consumer参考文档Spring Boot Kafka - 用Multi-Consumer应对高吞吐量前言前面几篇文章讲到了Spring Kafka如何来发送消息和接收消息。本文描述了如何用Multi-Consumer应对高吞吐量的场景。主题与分区Kafka的消息通过Topic(主题)进行分类。主题就 好比文件系统的文件夹。主题原创 2021-08-18 09:41:10 · 1038 阅读 · 0 评论 -
Spring Boot Kafka - 如何处理毒丸(Poison Pill)消息
文章目录Spring Boot Kafka - 如何处理毒丸(Poison Pill)消息前言模拟毒丸(Poison Pill)消息使用ErrorHandlingDeserializer处理反序列化失败参考文档Spring Boot Kafka - 如何处理毒丸(Poison Pill)消息前言在Spring Boot Kafka - 序列化和反序列化JSON 一文中描述了如何在发送消息和接收消息时作JSON序列化和反序列化。但是上文只考虑了最乐观的情况,如何接收消息时反序列化失败,会怎么样?如果原创 2021-08-17 18:52:38 · 2280 阅读 · 1 评论 -
Spring Boot Kafka - 序列化和反序列化JSON
文章目录Spring Boot Kafka - 序列和反序列化JSON前言配置JsonSerializer和JsonDeserializer定义一个Model类Producer类Consumer类Controller类测试小结参考文档Spring Boot Kafka - 序列和反序列化JSON前言在在Spring Boot应用集成Kafka读写消息 一文中说明了如何通过Spring Kafka来发送和接收字符串消息。本文描述了如何通过Spring Kafka如何在发送消息时序列化JSON(将对象转原创 2021-08-17 17:59:57 · 6609 阅读 · 0 评论 -
在Spring Boot应用中使用Spring Security Annotation
文章目录在Spring Boot应用中使用Spring Security Annotation前言取消在SecurityConfig类中根据路径鉴权开启Spring Security Annotation使用`@RolesAllowed` 注解Spring Security Annotations小结自定义Spring Security Annotations小结参考文档在Spring Boot应用中使用Spring Security Annotation前言在在Spring Boot应用中集成Key原创 2021-07-22 12:06:37 · 912 阅读 · 0 评论 -
在Spring Boot应用中集成Keycloak作认证和鉴权
文章目录在Spring Boot应用中集成Keycloak作认证和鉴权前言引入依赖Spring Security依赖Keycloak依赖Thymeleaf依赖安装Keycloak在Keycloak上配置构建Spring Boot应用配置Keycloak属性Keycloak安全配置Web层Keycloak工具类小结参考文档在Spring Boot应用中集成Keycloak作认证和鉴权前言本文描述了在Spring Boot应用中通过Spring Security集成Keycloak来实现用认证和鉴权。工原创 2021-07-16 20:38:27 · 4335 阅读 · 2 评论 -
Spring Boot 学习资料(持续更新)
文章目录Spring Boot 学习资料(持续更新)前言图书文档教程Spring Boot架构创建Spring Boot项目运行Spring Boot应用Spring Boot组件Spring Boot StarterSpring AnnotationsSpring Data JPASpring Boot Dev ToolsSpring Boot TestingSpring SecuritySpring Boot Thymeleaf使用Spring Boot构建微服务Spring Boot 学习资料(持续原创 2021-07-16 12:11:32 · 647 阅读 · 0 评论 -
在Spring Boot应用中集成Spring Security实现用户注册和登录
文章目录在Spring Boot应用中集成Spring Security实现用户注册和登录前言引入依赖引入Spring Security依赖引入Spring Data JPA和MySQL依赖引入Thymeleaf依赖引入前端依赖引入其他依赖表设计API设计应用配置配置Spring SecurityWeb层HomeController类RegistrationController类RegistrationDto类字段校验Service层数据层JPA EntitiesUser Entity类Role Entit原创 2021-07-14 20:01:41 · 2255 阅读 · 0 评论 -
Spring Boot Test 系列5 - 用Swagger2来管理API文档和测试API
文章目录Spring Boot Test 系列5 - 用Swagger2来管理API文档和测试API前言引入Swagger依赖配置Swagger访问Swagger为API添加描述测试API在生产上禁用SwaggerSwagger与Yapi或Postman集成参考文档Spring Boot Test 系列5 - 用Swagger2来管理API文档和测试API前言本文为Spring Boot Test系列的第五篇的用Swagger2来管理API文档和测试API。引入Swagger依赖引入Swagger原创 2021-07-12 18:29:04 · 493 阅读 · 0 评论 -
Spring Boot Test 系列4 - 深入探究使用WebTestClient作API测试
文章目录Spring Boot Test 系列4 - 深入探究使用WebTestClient作API测试前言API设计资源创建Controller类Case 1 - 查询全部用户编写测试运行测试-失败定义API运行测试-成功Case 2 - 创建新用户编写测试运行测试-失败定义POST方法运行测试-成功Case3 - 查询指定ID的用户编写测试运行测试-失败定义API运行测试-成功Case3 - 删除指定ID的用户编写测试运行测试-失败定义DELETE方法运行测试-成功单元测试小结集成测试驱动开发创建集成测原创 2021-07-12 11:55:06 · 1648 阅读 · 1 评论 -
Spring Boot Test 系列3 - 使用WebTestClient测试Web层
文章目录Spring Boot Test 系列3 - 使用WebTestClient测试Web层前言使用WebTestClient测试Web层引入spring-boot-starter-webflux依赖使用WebTestClient代替TestRestTemplate使用WebTestClient代替MockMvc小结参考文档Spring Boot Test 系列3 - 使用WebTestClient测试Web层前言本文为Spring Boot Test系列的第三篇的使用WebTestClient测原创 2021-07-11 15:00:22 · 2855 阅读 · 3 评论 -
Spring Boot Test 系列2 - 测试Web层
文章目录Sprint Boot Test 系列2 - 测试Web层前言测试Web层启动server来测试加载mock的Application Context来测试加载Web层来测试Mock Service层测试Web层小结参考文档Sprint Boot Test 系列2 - 测试Web层前言本文为Spring Boot Test系列的第二篇的测试Web层。前置文章:Sprint Boot Test 系列1 - 入门测试Web层启动server来测试测试Web层的一种方式是启动server原创 2021-07-11 11:18:55 · 1042 阅读 · 0 评论 -
Spring Boot Test 系列1 - 入门
文章目录Sprint Boot Test 系列1 - 入门前言创建Spring Boot项目Spring Boot Starter Test依赖集成测试集成测试,不启动server集成测试,启动server单元测试后记参考文档Sprint Boot Test 系列1 - 入门前言本文为Spring Boot Test系列的第一篇的入门文章。工具:Intellij IDEA UltimateSpring Boot 2.4.0JUnit5 (Spring Boot Test 2.4.0默认为JU原创 2021-07-10 23:13:54 · 910 阅读 · 0 评论 -
在OpenShift上使用Hystrix Dashboard和Turbine来汇聚和可视化展示Hystrix指标
文章目录在OpenShift上使用Hystrix Dashboard和Turbine来汇聚和可视化展示Hystrix指标前言为服务采用Hystrix机制Hystrix Dashboard应用说明引入依赖Application 类bootstrap 配置application 配置OpenShift使用的application配置本地调试使用的application配置本地使用Hystrix DashboardOpenShift上使用Hystrix Dashboard参考文档在OpenShift上使用Hys原创 2020-12-13 12:20:18 · 499 阅读 · 0 评论 -
配置Spring Cloud Config Server连接私有GitLab repository
文章目录配置Spring Cloud Config Server连接私有GitLab repository前言用SSH private key properties方式连接GitLab私有repository生成JGit需要的PEM格式的RSA private key将public key添加到GitLab上在Config Server上配置private key properties参考文档配置Spring Cloud Config Server连接私有GitLab repository前言Spri原创 2020-12-11 10:08:08 · 1597 阅读 · 0 评论 -
在OpenShift上动态更新Spring Boot应用的配置
文章目录在OpenShift上动态更新Spring Boot应用的配置前言Spring Boot应用改造引入Spring Cloud Kubernetes Config依赖新建bootstrap.yaml配置示例代码示例1: 通过`@ConfigurationProperties`动态获取外部配置属性的值代码示例2: 通过`@RefreshScope`和`@Value`动态获取外部配置属性的值本地测试在OpenShift上创建和配置ConfigMap为`default` Service Account授权创原创 2020-11-29 20:51:54 · 1522 阅读 · 0 评论 -
在OpenShift中对Spring Boot应用作健康检查
文章目录在OpenShift中对Spring Boot应用作健康检查前言Spring Boot Actuator在OpenShift上配置Health ChecksOpenShfit健康检查基本概念配置Health ChecksReadiness ProbeLiveness ProbeStartup Probe参考文档在OpenShift中对Spring Boot应用作健康检查前言本文描述了在OpenShift中使用Spring Boot Actuator来对Spring Boot应用作健康检查。S原创 2020-11-28 14:21:00 · 1109 阅读 · 0 评论 -
从零开始在OpenShift上开发和部署Spring Boot应用
文章目录从零开始在OpenShift上开发和部署Spring Boot应用前言工具和环境本地开发和测试Spring Boot应用项目创建Spring Boot应用项目本地开发环境配置访问本地H2数据库创建表和初始化数据编写代码测试应用准备在测试环境上部署Spring Boot应用测试环境配置创建GitHub仓库并推送到GitHub在OpenShfit测试环境上部署应用在OpenShift上创建项目在OpenShift项目下安装MySQL数据库查看MySQL数据库的属性创建数据库表和初始化数据在OpenShi原创 2020-11-28 09:32:11 · 2442 阅读 · 0 评论 -
解决Intellij中Spring Boot Devtools不能自动自动刷新的问题
文章目录解决Intellij中Spring Boot Devtools不能自动自动刷新的问题前言原因解决方法方法一:手动触发构建方法二:开启自动构建,并允许更新正在运行的应用参考文档解决Intellij中Spring Boot Devtools不能自动自动刷新的问题前言在Intellj中,Spring Boot项目中已经引入了spring-boot-devtools的Maven依赖: <dependency> <groupId>org.springframework.b原创 2020-10-19 11:36:16 · 2645 阅读 · 0 评论 -
如何禁用Spring Boot内置Undertow的HTTP TRACE/TRACK
文章目录如何禁用Spring Boot内置Undertow的HTTP TRACE/TRACK前言测试应用是否允许HTTP TRACE禁用Spring Boot内置的Undertow的HTTP TRACE/TRACK参考文档如何禁用Spring Boot内置Undertow的HTTP TRACE/TRACK前言因为安全原因,需要禁用Spring Boot内置Web服务器的HTTP TRACE/TRACK方法。Spring Boot版本:spring-boot:2.2.2.RELEASE内置Web服原创 2020-09-11 19:29:57 · 12405 阅读 · 2 评论 -
Spring DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144
文章目录Spring DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144前言问题分析问题解决过程通过配置参数加大缓冲区通过配置类加大缓冲区限制接口返回JSON的大小检查网关的拦截器(Filter)是否操作了HTTP body问题解决结果Spring DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144前言最近在项目中遇原创 2020-06-24 17:58:00 · 30592 阅读 · 6 评论 -
加密Spring Boot项目中配置文件的明文密码
文章目录加密Spring Boot项目中配置文件的明文密码添加依赖和插件使用jasypt加密过程小结参考文档加密Spring Boot项目中配置文件的明文密码如果不想在Spring Boot项目配置文件存储明文密码(比如MySQL密码、Redis密码等),一种简单的方法的方法是运行Spring Boot应用时以注入环境变量的方式来注入密码,另外一种就是在配置文件中加密存储明文密码。本文讲解了...原创 2020-04-08 11:24:31 · 4410 阅读 · 0 评论 -
MyBatis使用PageHelper排序分页
文章目录MyBatis使用PageHelper排序分页前言排序分页使用PageHelper排序分页添加PageHelper Spring Boot依赖新增一个列表查询的方法使用PageHelper来设置排序分页查询条件测试和查看日志参考文档MyBatis使用PageHelper排序分页前言前面说明了:Spring Boot使用MyBatis访问MySQLSpring Boot统一RES...原创 2020-03-23 08:13:52 · 5290 阅读 · 0 评论 -
Spring Boot统一REST API接口响应格式和异常处理
文章目录Spring Boot统一REST API接口响应格式和异常处理前言定义统一的接口响应格式接口调用成功时返回统一的接口响应格式发生异常时返回统一的接口响应格式参考文档Spring Boot统一REST API接口响应格式和异常处理前言在REST API接口中,非常有必要统一接口响应格式。示例:{ "code": 0, "message": "OK", "data": ...原创 2020-03-22 23:39:32 · 3042 阅读 · 1 评论 -
在Spring Boot中输出日志
文章目录在Spring Boot中输出日志Spring Boot日志默认配置日志级别(logging level)使用logback或log4j2日志使用logback使用log4j2在代码中输出日志参考文档在Spring Boot中输出日志Spring Boot日志默认配置Spring Boot提供了“开箱即用”的日志功能,默认配置如下:默认只输出日志到控制台默认日志级别为INFO...原创 2020-02-26 18:02:56 · 1710 阅读 · 0 评论 -
在Spring Boot中使用Druid数据库连接池
文章目录在Spring Boot中使用Druid数据库连接池前言引入Spring Boot Druid Starter配置Druid数据库连接池加密数据库密码日志监控参考文档在Spring Boot中使用Druid数据库连接池前言在 使用IDEA开发Spring Data JPA for MySQL 一文中我们使用了Spring Data JPA来访问MySQL数据库,而在真实环境中,为了性...原创 2020-02-25 23:10:16 · 6220 阅读 · 0 评论 -
Spring Boo使用Spring Data JPA访问MySQL
文章目录使用IDEA开发Spring Data JPA for MySQL官方示例教程工具开发过程创建表自动生成JPA Entity添加Lombok支持修改UserRepository类配置数据库连接测试常见问题Q: 连接数据库时报`serverTimezone`的错Q: 'hibernate.dialect' not setQ: Table 'XXX.hibernate_sequence' do...原创 2020-02-25 15:35:51 · 666 阅读 · 0 评论 -
Spring Boot使用MyBatis访问MySQL
文章目录Spring Boot使用MyBatis访问MySQL创建Spring Boot项目配置MySQL数据库连接创建数据库表自动生成代码在IDEA Database中配置数据库连接使用Free MyBatis Plugin自动生成代码完善自动生成的代码配置MyBatis编写Controller类测试参考文档Spring Boot使用MyBatis访问MySQL环境:Intellij I...原创 2020-03-21 22:39:06 · 1099 阅读 · 0 评论
分享