EntityRepositoryScanner { public static void scan() throws IllegalAccessException, InstantiationException { LOG.info("Scanning all entity repositories"); StopWatch stopWatch = new StopWatch(); stopWatch.start(); for (Class<? extends EntityRepository> entityRepoClass : ReflectionsHelper.getInstance() .getSubTypesOf(EntityRepository.class)) { if (EntityRepository.class.isAssignableFrom(entityRepoClass)) { EntityRepository repo = entityRepoClass.newInstance(); addRepo(repo); } } stopWatch.stop(); LOG.info("Finished scanning entity repositories in {} ms", stopWatch.getTime()); }  static void scan();  }
@Test public void testScan() throws InstantiationException, IllegalAccessException { Assert.assertEquals(MetricMetadataEntity.class, EntityDefinitionManager .getEntityByServiceName("MetricMetadataService").getEntityClass()); }