if (reg == null) {
throw new IllegalArgumentException("Class " + clazz.getName() + " is not annotated with @Service");
}
}
for (Method method : clazz.getDeclaredMethods()) {
Destroy ann = method.getAnnotation(Destroy.class);
if (ann != null && method.getParameterTypes().length == 0 && method.getReturnType() == void.class) {
method.setAccessible(true);
method.invoke(instance);
}
}