OpeningO-spring-boot-xSpring Boot 扩展
spring-boot-x是springboot应用的扩展。
特性清单
-
手动事务管理 [2021.6.29更新]
-
分布式id生成器gedid,DidLoader [ 2021.6.25更新 ]
-
Safety工具 [ 2021.6.25更新 ]
-
请求日志,包括请求源、请求目标、请求参数、处理时间、错误异常等信息;
-
请求响应参数的自动装配(映射);
-
跨域的配置;
-
嵌入
SpringBoot
的异常处理机制,可以将原来的错误信息中插入其他信息、或将其解析或转换为其他信息; -
如
SpringBoot
之starter
动态装配或在yml
中配置相关特性; -
简化的
Redis
操作; -
提炼
Elasticsearch
之HighlevelClient
常用操作; -
feign
的请求头参数的处理:合并上下游的请求头参数,并发场景的数据处理策略; -
基于
Druid
和Hikari
的动态路由RoutingDataSource
; -
SpringBoot
应用的配置信息的自动拷贝;
1. 请求日志
**************************************************************** :: SpringApplicationX :: for current request report information **************************************************************** Client IP : 127.0.0.1 Request Time : 2020-07-12T19:24:40.249 Controller : org.openingo.x.controller.UserController.(UserController.java:1) URI : http://localhost:8080/json Handler(Action) : json Method : GET Processing Time : 0.002s Header(s) : [user-agent:"PostmanRuntime/7.25.0", cache-control:"no-cache", postman-token:"b29a0616-7e31-4150-b022-4bf3680bf771", host:"localhost:8080", accept-encoding:"gzip, deflate, br", connection:"keep-alive", content-length:"21", Content-Type:"application/json;charset=UTF-8"] Body : {"name":"qicz"} Response : {"name":"qicz","age":18} ----------------------------------------------------------------
2. 错误处理
可以继承AbstractServiceErrorAttributes,扩展exception的处理
{ "timestamp": "2020-07-13T05:49:06.071+0000", "status": 500, "error": "Internal Server Error", "exception": "org.openingo.spring.exception.ServiceException", "message": "testing exception", "path": "/ex", "handler": "public java.util.Map org.openingo.x.controller.UserController.ex()", "openingo.error": { "ex": "org.openingo.spring.exception.ServiceException: testing exception", "em": "testing exception", "error": "Internal Server Error", "ec": "ERROR_CODE" } }
3. 使用及配置
加入spring-boot-x依赖(已托管在中央仓库),在启动class上加入@EnableExtension注解即可使用spring-boot-x的扩展功能。
通过application.yml/application.properties可以对请求日志redis等操作进行开关。默认情况下,请求日志及错误扩展为开启状态。
openingo: redis: enable: true http: request: cors: allowed-header: "*" enable: true allowed-all: true log: enable: true error: enable: true
评论
dew-framework对 Spring Cloud/Boot 的封装扩展框架
Dew 是对 Spring Cloud/Boot 的封装扩展、整合公司现有能力、提供最佳实践,做为基
dew-framework对 Spring Cloud/Boot 的封装扩展框架
0
dew-framework对 Spring Cloud/Boot 的封装扩展框架
Dew是对SpringCloud/Boot的封装扩展、整合公司现有能力、提供最佳实践,做为基础服务框架,支撑公司新项目地研发。Dew[du:]意为`露水`,希望此框架可以像晨间的露水一样透明、静谧、丰
dew-framework对 Spring Cloud/Boot 的封装扩展框架
0
ShellJSNode.js 扩展
ShellJS是Node.js扩展,用于实现Unixshell命令执行,支持Windows。示例代码:require('shelljs/global');if(!which('git')){echo(
ShellJSNode.js 扩展
0
StarPUGCC 扩展
StarUP通常用来帮助高性能的类库和编译环境探索不同体系结构的多核架构。StarPU是一组GCC扩展和相关联的运行时系统,旨在促进异构系统的编程-例如,具有可编程图形处理单元的计算机。“StarPU
StarPUGCC 扩展
0
JspTestjunit扩展
JspTest是一个不依赖予容器,对jsp页面进行单元测试的junit扩展。内部它使用Jasper作为jsp编译引擎---tomcat的jsp引擎。对于使用maven作为构建工具的团队或个人,使用非常
JspTestjunit扩展
0