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> 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:
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.9-RC1</version>
</dependency>
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. Thanks
Aucun commentaire:
Enregistrer un commentaire