sprig-boot-x是sprigboot应用的扩展。
特性清单手动事务管理[2021.6.29更新]
分布式id生成器gedid,DidLoader[2021.6.25更新]
Safety工具[2021.6.25更新]
请求日志,包括请求源、请求目标、请求参数、处理时间、错误异常等信息;
请求响应参数的自动装配(映射);
跨域的配置;
嵌入SprigBoot的异常处理机制,可以将原来的错误信息中插入其他信息、或将其解析或转换为其他信息;
如SprigBoot之starter动态装配或在yml中配置相关特性;
简化的Redis操作;
提炼Elasticsearch之HighlevelCliet常用操作;
feig的请求头参数的处理:合并上下游的请求头参数,并发场景的数据处理策略;
基于Druid和Hikari的动态路由RoutigDataSource;
SprigBoot应用的配置信息的自动拷贝;
1.请求日志
****************************************************************::SprigApplicatioX::forcurretrequestreportiformatio****************************************************************ClietIP:127.0.0.1RequestTime:2020-07-12T19:24:40.249Cotroller:org.opeigo.x.cotroller.UserCotroller.(UserCotroller.java:1)URI:https://localhost:8080/jsoHadler(Actio):jsoMethod:GETProcessigTime:0.002sHeader(s):[user-aget:"PostmaRutime/7.25.0",cache-cotrol:"o-cache",postma-toke:"b29a0616-7e31-4150-b022-4bf3680bf771",host:"localhost:8080",accept-ecodig:"gzip,deflate,br",coectio:"keep-alive",cotet-legth:"21",Cotet-Type:"applicatio/jso;charset=UTF-8"]Body:{"ame":"qicz"}Respose:{"ame":"qicz","age":18}----------------------------------------------------------------2.错误处理
可以继承AbstractServiceErrorAttributes,扩展exceptio的处理
{"timestamp":"2020-07-13T05:49:06.071+0000","status":500,"error":"IteralServerError","exceptio":"org.opeigo.sprig.exceptio.ServiceExceptio","message":"testigexceptio","path":"/ex","hadler":"publicjava.util.Maporg.opeigo.x.cotroller.UserCotroller.ex()","opeigo.error":{"ex":"org.opeigo.sprig.exceptio.ServiceExceptio:testigexceptio","em":"testigexceptio","error":"IteralServerError","ec":"ERROR_CODE"}}3.使用及配置
加入sprig-boot-x依赖(已托管在中央仓库),在启动class上加入@EableExtesio注解即可使用sprig-boot-x的扩展功能。
通过applicatio.yml/applicatio.properties可以对请求日志redis等操作进行开关。默认情况下,请求日志及错误扩展为开启状态。
opeigo:redis:eable:truehttp:request:cors:allowed-header:"*"eable:trueallowed-all:truelog:eable:trueerror:eable:true







评论