6 Replies Latest reply on Mar 28, 2017 1:50 AM by Philippe Marschall

    Wildfly and Reflections library

    Avishay Ben Natan Newbie


      I am trying to scan classes with Reflections library, if I add the Dynamic Web project to another project (plain Java one), I get the classes I want, if run inside a @Startup bean, it is empty.

      Here is the code:

      Reflections reflections = new Reflections(new ConfigurationBuilder().filterInputsBy(new FilterBuilder.Include(FilterBuilder.prefix("my.package"))).setUrls(ClasspathHelper.forJavaClassPath()).setScanners(new SubTypesScanner(false)));
      Set<Class<? extends Object>> testClasses = reflections.getSubTypesOf(Object.class);

      The tv,goopi should be changed to whatever package prefix used.

      the testClasses Set is empty.


      If the same code is running in a different project referencing this one, no other change, then the Set is populated with all classes inside the package.


      The Maven dependency for Reflections is:



      Wildfly 8.2.0

      For now, I can save the file extracted in the external project and use the load function, but this will not be dynamic as it should be.