问题集(一)

1、方法中不要返回null,利用springboot的特性,抛出异常,这样可以避免对方法返回值的判空处理

2、不要写内部类,如果一个类只是给指定的一个类使用,可以写一个只有包内部可以调用的类

3、代码不要耦合,一个类只完成一个独立的功能

4、新特性

Map<String, String> map = list.stream().collect(Collectors.toMap(Person::getId, Person::getName));

Map<String, List<EntityModelEntity>> modelMap = entityModels.stream().collect(Collectors.groupingBy(EntityModelEntity::getCode));

5、服务之间不要循环引用

6、不要吃掉异常

 

posted @ 2022-09-13 18:13  1156740846  阅读(10)  评论(0编辑  收藏  举报