天天掉坑
战神陈佩斯
我们仰望着同一片天空,脚下却踩着不同的大地
展开
-
接口参数转换异常MethodArgumentTypeMismatchException的异常处理
最近发现上游系统有HTTP调用本服务中一个接口参数转换异常的情况,具体情况是接口定义为Long类型参数但上游传输参数为String导致接口参数转换失败,但服务中接口众多,线上日志只打印了接口转换失败,也没描述是哪个接口导致的,异常的堆栈也被挤下去了看不到,所以需要通过异常处理日志统一解决一下,在这里做一下记录异常封装 @ExceptionHandler(MethodArgumentTypeMismatchException.class) public ReturnMsg mismatchE原创 2021-12-29 10:33:12 · 3478 阅读 · 0 评论 -
Cannot autogenerate id of type java.lang.Integer for entity of type com.mongodb.pojo.User!
第一次尝试使用MongoDB对实体进行插入操作,结果出现 Cannot autogenerate id of type java.lang.Integer for entity of type com.mongodb.pojo.User!大概意思是不能将ID转换为IntegerMongoDB默认的集合主键是“_id”,类型是ObjectId。ObjectId是一个12字节的BSON类型字符串,包含了UNIX时间戳,机器识别码,进程号,计数值信息。机器码用来防止分布式系统生成id时冲突的问题,保证每台原创 2021-09-08 09:56:05 · 1886 阅读 · 0 评论 -
fastJson出现重复引用“$ref“:“$.in“
demo:public class JsonMapTest { public static void main(String[] args) { HashMap<String, Object> exam = new HashMap<>(); exam.put("out_trade_no",null); ArrayList<Map<String,Object>> in = new ArrayList&l原创 2021-09-07 19:43:17 · 69 阅读 · 0 评论