Class
// 反射
public BaseServiceImpl() {
Type type = this.getClass().getGenericSuperclass();
ParameterizedType ptype = (ParameterizedType) type;
this.clazz = (Class<T>) ptype.getActualTypeArguments()[0];
}
Class
// 反射
public BaseServiceImpl() {
Type type = this.getClass().getGenericSuperclass();
ParameterizedType ptype = (ParameterizedType) type;
this.clazz = (Class<T>) ptype.getActualTypeArguments()[0];
}
原文:https://www.cnblogs.com/sidekick/p/8343762.html