接着之前的项目进行开发
新建MyBeanUtils类
public class MyBeanUtils {
public static String[] getNullPropertyNames(Object source){
BeanWrapper beanWrapper=new BeanWrapperImpl(source);
PropertyDescriptor[] pds=beanWrapper.getPropertyDescriptors();
List<String> nullPropertyNames=new ArrayList<>();
for (PropertyDescriptor pd:pds){
String propertyName=pd.getName();
if(beanWrapper.getPropertyValue(propertyName)==null){
nullPropertyNames.add(propertyName);
}
}
return nullPropertyNames.toArray(new String[nullPropertyNames.size(

本文介绍了在SpringBoot项目中如何实现日志记录,通过新建MyBeanUtils类和LogAspect切面来追踪和打印日志,从而帮助进行错误排查。
最低0.47元/天 解锁文章
4875

被折叠的 条评论
为什么被折叠?



