报错内容:
Exception in thread “main” java.lang.IllegalAccessException: Class Test can not access a member of class xxxx with modifiers “private”
再现情况:
使用反射获取实体类私有字段自定义注解的值。
如何解决:
类属性加上 field.setAccessible(true);
报错内容:
Exception in thread “main” java.lang.IllegalAccessException: Class Test can not access a member of class xxxx with modifiers “private”
再现情况:
使用反射获取实体类私有字段自定义注解的值。
如何解决:
类属性加上 field.setAccessible(true);