通过反射获取子类确定的泛型类

private Class<T> entityClass ;

entityClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];

原文地址:https://www.cnblogs.com/james-roger/p/5163348.html