public List<EventCategoryTO> listAuditEvents() {
// use set to avoi duplications or null elements
final Set<EventCategoryTO> events = new HashSet<EventCategoryTO>();
try {
final ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
final MetadataReaderFactory metadataReaderFactory =
new CachingMetadataReaderFactory(resourcePatternResolver);
final String packageSearchPath =
ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ ClassUtils.convertClassNameToResourcePath(
SystemPropertyUtils.resolvePlaceholders(this.getClass().getPackage().getName()))
+ "/" + "**/*.class";
final Resource[] resources = resourcePatternResolver.getResources(packageSearchPath);
for (Resource resource : resources) {
if (resource.isReadable()) {
final MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(resource);
final Class<?> clazz = Class.forName(metadataReader.getClassMetadata().getClassName());