![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring生态
文章平均质量分 67
苦杏仁
心无旁骛!
展开
-
SpringBoot RestControllerAdvice Controller统一异常处理,数据统一拦截处理
POM<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/x原创 2021-01-12 17:58:59 · 577 阅读 · 0 评论 -
SpringContext-Event事件驱动(适用于单机异步解耦-且允许失败率的情况-停机重启会丢失)
1.POM Maven 依赖<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.or原创 2020-10-23 09:45:36 · 791 阅读 · 0 评论 -
SpringBoot 配置文件读取(固定前缀)
1.配置文件所有固定前缀的 都可以使用SpringBoot自动注入实体类如下配置配置文件:application.properties固定前缀:sys.test.config配置信息:sys.test.config.industryKey=aaasys.test.config.systemName=bbbsys.test.config.downloadUrl=cccsys.test.config.traceDomain=ddd2.SpringBoot实体类import o.原创 2020-10-23 09:35:18 · 3323 阅读 · 0 评论 -
Spring 自带验证框架 - MVC架构 - 前端给后端传递数据时校验数据-较为方便
POM依赖<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org原创 2020-11-26 16:35:27 · 244 阅读 · 1 评论 -
SpringBoot2.X给所有Controller添加统一前缀
1. 在配置文件中添加:server.servlet.context-path:/prefix_name即可(不同SpringBoot版本会有区别,这里是采用2.0 ) 2.在访问的时候就可以这样访问了 http://xxx:port/prefix_name/xxxxx/xxx/xxx 了;全局配置 - 很方便;...原创 2020-08-01 10:34:47 · 1912 阅读 · 0 评论 -
Spring 相关文章摘录(先摘录后续有时间再详细分析记录)
1.Spring 事件机制 相关https://www.jianshu.com/p/786509ddb853https://www.cnblogs.com/fingerboy/p/9229164.html原创 2020-07-15 13:10:51 · 100 阅读 · 0 评论 -
根据不同配置加载不同的实现类
1. 简介Spring Boot通过@ConditionalOnProperty来控制Configuration是否生效2. 源码 - 说明@Retention(RetentionPolicy.RUNTIME)@Target({ ElementType.TYPE, ElementType.METHOD })@Documented@Conditional(OnPrope...转载 2019-12-31 11:43:33 · 782 阅读 · 0 评论 -
springMVC 基于XML的配置-解决跨域问题
基于XML的配置mvc:cors>mvc:mappingpath="/**" />mvc:cors>同样, 可以做更复杂的配置:mvc:cors> mvc:mapping path="/api/**" allowed-origins="http://domain1.com, http://domain2原创 2017-12-26 10:31:03 · 2172 阅读 · 0 评论 -
Spring MVC json 转换 复杂类型用fastjson较好
<!-- 写在最前边 --><bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"> <property name="messageConverters"> <list> ...原创 2020-01-03 09:57:45 · 120 阅读 · 0 评论 -
Spring Cloud Gateway - 转载
本文转载自:https://www.cnblogs.com/cjsblog/p/11099234.html1. 为什么是Spring Cloud Gateway一句话,Spring Cloud已经放弃Netflix Zuul了。现在Spring Cloud中引用的还是Zuul 1.x版本,而这个版本是基于过滤器的,是阻塞IO,不支持长连接。Zuul 2.x版本跟1.x的架构大一样,性能也...翻译 2020-03-17 11:58:59 · 193 阅读 · 0 评论