
SpringBoot/SpringCloud
微服务分栏
紫悦秋
这个作者很懒,什么都没留下…
展开
-
spring请求返回结果的时候报json转换填充异常
2020-06-12 15:08:15.513 ERROR 42824 --- [nio-8764-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframew.原创 2020-06-12 15:22:03 · 624 阅读 · 0 评论 -
解决SpringCloud项目启动报错:Error creating bean with name peerEurekaNodes defined in class path resource
Spring Cloud 项目启动失败2019-05-05 15:22:12.096 WARN 16912 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDepend原创 2020-06-11 22:56:13 · 2447 阅读 · 0 评论 -
9种分布式ID生成方式
https://mp.weixin.qq.com/s/-_KLEGVmREI5Y2Y5HWImWw一、为什么要用分布式ID?在说分布式ID的具体实现之前,我们来简单分析一下为什么用分布式ID?分布式ID应该满足哪些特征?1、什么是分布式ID?拿MySQL数据库举个栗子:在我们业务数据量不大的时候,单库单表完全可以支撑现有业务,数据再大一点搞个MySQL主从同步读写分离也能对付。...原创 2020-03-31 18:23:04 · 183 阅读 · 0 评论 -
hibernate.validator校验
为什么要使用hibernate.validator?我们在编写接口的时候,会有各种各样形式的入参。我们不可能不做任何校验就直接进入业务代码进行程序运行,因为我们都会有个基础数据验证机制。比如入参是否为空,是否为数字,是否为正确的日期格式等等。这种基础的数据验证,代码并不复杂,但是要每个业务类都去写,工作量就翻倍加了,而且每个接口都写也是不符合常理的编码。而数据验证又分为两种,一种是无业务关联的...原创 2019-11-26 13:41:44 · 609 阅读 · 0 评论 -
Spring @autowire 和@resource的区别和使用场景
Spring通过@Resource注解和@Autowire实现自动装配。@Resource 根据byName进行装配;默认按名称装配,当找不到与名称匹配的bean时才按照类型进行装配。名称可以通过name属性指定,如果没有指定name属性,当注解写在字段上时,默认取字段名,当注解写在setter方法上时,默认取属性名进行装配。@Autowire通过byType进行装配;默认按类型装配,默认...原创 2019-11-04 14:06:56 · 2242 阅读 · 0 评论 -
Spring Boot 2 实战: 自定义 Servlet Filter 的两种方式
1.前言有些时候我们需要在Spring Boot Servlet Web应用中声明一些自定义的Servlet Filter来处理一些逻辑。比如简单的权限系统、请求头过滤、防止XSS攻击等。本篇将讲解如何在Spring Boot应用中声明自定义 Servlet Filter 以及定义它们各自的作用域和顺序。2. 自定义 Filter可能有人说声明 Servlet Filte...原创 2020-01-16 17:17:03 · 219 阅读 · 0 评论 -
SpringBoot整合jsp启动报错:Unable to start embedded container; nested exception is java.lang.NoSuchMethodEr
解决方法是:在pom.xml配置文件里添加<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.0.2.RELE...原创 2019-07-18 13:02:32 · 366 阅读 · 0 评论 -
@WebServlet的使用方法
下面是@WebServlet的属性列表。从上表可见,web.xml可以配置的servlet属性,在@WebServlet中都可以配置。@WebServlet(description="FileDownload",urlPatterns={"/downloadFileServlet"},loadOnStartup=1)public class Download...原创 2019-07-15 17:01:47 · 1117 阅读 · 0 评论 -
SpringBoot组件扫描注册配置
转自:https://segmentfault.com/a/1190000019093670Servlet 3.0 之前,Servlet、Filter、Listener 这些组件都需要在web.xml中进行配置,3.0 之后开始不再需要web.xml这个配置文件了,所有的组件都可以通过代码配置或者注解来达到目的。如下图所示,截图自 Servlet 3.1。Servlet 3...转载 2019-07-15 16:55:31 · 849 阅读 · 0 评论 -
SpringBoot整合Servlet的两种方式
1.通过注解扫描完成Servlet组件的注册(组件扫描注册);这种方式在控制台看到了相关的输出信息,但是在浏览器打开的时候是错误的页面信息@ServletComponentScan("com.jlt.workplat.report.servlet")// 在SppringBoot启动时扫描@WebServlet,并将该类实例化@EnableRedisHttpSession(m...原创 2019-07-15 16:28:51 · 328 阅读 · 0 评论