随笔分类 - SpringBoot
摘要:kk-anti-reptile 是适用于基于 spring-boot 开发的分布式系统的反爬虫组件。 系统要求 基于 spring-boot 开发(spring-boot1.x, spring-boot2.x均可 需要使用 redis 工作流程 kk-anti-reptile 使用基于 Servle
阅读全文
摘要:在实际项目使用中,必须要考虑服务的安全性,当服务部署到互联网以后,就要考虑服务被恶意请求和暴力攻击的情况,下面的教程,通过intercept和redis针对url+ip在一定时间内访问的次数来将ip禁用,可以根据自己的需求进行相应的修改,来打打自己的目的; 首先工程为springboot框架搭建,不
阅读全文
摘要:一、摘要 springboot + quartz + mysql 实现持久化分布式调度 集群环境任务调度测试 二、Quartz 集群架构 Quartz 是 Java 领域最著名的开源任务调度工具。 在上篇文章中,我们详细的介绍了 Quartz 的单体应用实践,如果只在单体环境中应用,Quartz 未
阅读全文
摘要:一、前置条件 demo中,将多个文件通过zip的形式进行下载,所以需要引入以下maven坐标: <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-compress</artifactId> <version>
阅读全文
摘要:package com.dzqc.yx.util; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springfra
阅读全文
摘要:redis的发布订阅模式,使发布者和订阅者完全解耦 1.pom.xml and application.properties <!-- 引入redis --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>s
阅读全文
摘要:一、Quartz 集群架构 Quartz 是 Java 领域最著名的开源任务调度工具。 在上篇文章中,我们详细的介绍了 Quartz 的单体应用实践,如果只在单体环境中应用,Quartz 未必是最好的选择,例如Spring Scheduled一样也可以实现任务调度,并且与SpringBoot无缝集成
阅读全文
摘要:官方参考:https://spring.io/projects/spring-cloud SpringCloud版本 SpringBoot版本 Hoxton 2.2.x 2.2.x Greenwich 2.1.x 2.1.x Finchley 2.0.x 2.0.x Edgware 1.5.x 1.
阅读全文
摘要:@ControllerAdvice配置讲解: package cn.org.spring.wechar.exception; import cn.org.spring.wechar.bean.Result; import lombok.extern.slf4j.Slf4j; import org.s
阅读全文
摘要:JSR303 是 Java EE 6 中的一项子规范,叫做 Bean Validation,官方参考实现是hibernate Validator,有了它,我们可以在实体类的字段上标注不同的注解实现对数据的校验,不用 if-else 判断,简化了我们的开发,而且可读性也很好。 但有时候它提供的注解并不
阅读全文
摘要:废话不说直接上代码!!! pom文件: <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </d
阅读全文
摘要:Springmvc 通过return "redirect:" 实现重定向 重定向的状态码301 302 301,302 都是HTTP状态的编码,都代表着某个URL发生了转移,不同之处在于: 301 redirect: 301 代表永久性转移(Permanently Moved)。 302 redir
阅读全文
摘要:一:@RequestBody和@RequestParam区别 @RequestParam用来处理Content-Type: 为 application/x-www-form-urlencoded编码的内容。(Http协议中,如果不指定Content-Type,则默认传递的参数就是applicatio
阅读全文