![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring、SpringBoot与SpringCloud
文章平均质量分 55
kokoHKM
这个作者很懒,什么都没留下…
展开
-
Redis解决雪花算法dataId和workId的自动选择问题
文章目录前言算法 1 代码算法 2 代码前言雪花算法是分布式系统中常用的唯一 id 生成算法,一般创建雪花算法的时候,依赖dataCenterId与workerId这两个值的取值都为 0~31 之间的整型。对于一个雪花算法的 id 生成器,需要设置这两个参数值。如果在单实例中,这两个值随便怎么设置都是没问题的,但是对于应用集群部署的时候,为了保证高可用,肯定需要多实例部署。这个时候...原创 2020-03-06 21:09:47 · 9894 阅读 · 4 评论 -
@ControllerAdvice 全局校验异常处理
旧版SpringMVC中的控制器参数校验: @ControllerAdvice public class ControllerCheckAdvice { private Logger log = LoggerFactory.getLogger(getClass()); @ExceptionHandler(BindExce...原创 2018-12-04 21:48:13 · 1001 阅读 · 0 评论 -
前端跨域请求问题
文章目录Spring Cloud Zuul的解决方案在Controller中配置Spring Cloud Zuul的解决方案package com.zhidianfan.pig.gateway.component.config;import org.springframework.context.annotation.Bean;import org.springframework.con...原创 2018-12-04 21:50:04 · 756 阅读 · 1 评论 -
AOP记录Controller日志
@Aspect@Component@Slf4jpublic class ReqResAop { @Pointcut("@annotation(org.springframework.web.bind.annotation.RequestMapping)" + "||@annotation(org.springframework.web.bind.annota...原创 2018-12-04 21:51:04 · 422 阅读 · 0 评论 -
devtools热更新
pom <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runt...原创 2018-12-04 21:51:52 · 308 阅读 · 0 评论 -
01 Spring与SpringMVC回顾
文章目录前言Spring核心Spring框架设计原则控制反转与依赖注入名词解释核心注解面向切面编程SpEL表达式Bean的生命周期异步方法定时任务小结SpringMVC核心MVC模式思想@ControllerAdvice文件上传HttpMessageConverter服务端推送技术:SSE小结前言SpringBoot本身没有增加任何新的技术,其是对Spring开发方式的一种简化。Spring...原创 2018-12-23 21:16:43 · 118 阅读 · 0 评论 -
02 SpringBoot核心
文章目录原理简介系统条件注解工具概述Spring Boot解决了什么问题Spring Boot 核心功能优缺点快速构建SpringBoot基本配置@SpringBootApplication关闭特定的自动注解定制Banner关闭 BannerSpring Boot 配置文件starter pom外部文件配置命令行参数application.yml中的配置类型安全的配置日志配置Profile配置Sp...原创 2018-12-24 13:17:14 · 158 阅读 · 0 评论 -
03 SpringBoot对Web的支持
文章目录支持Thymealeaf模板引擎配置Thymeleaf首页小结自动配置的Formatter和Converter接管Spring Boot 的Web配置注册Servlet、Filter、Listener国际化SpringBoot使用Undertowpom配置补充@ControllerAdviceTomcat配置替换Tomcat文件上传页面文件上传配置项Part方式上传MultipartFil...原创 2018-12-24 14:25:01 · 262 阅读 · 0 评论 -
04 SpringBoot对数据库的支持
文章目录简介常用子项目Repository接口CrudRepositoryPagingAndSortingRepository小结Spring Data JPA自动配置案例小结整合H2数据库HikariDataSource数据源配置java配置默认配置事务@TransactionalSpringBoot的事务支持缓存ehcacheredisMongoDBapplication.ymlpom实体类d...原创 2018-12-24 16:26:27 · 454 阅读 · 0 评论