I am using reflections to obtain all the classes that have the Api annotation with the following code.
Reflections reflections = new Reflections(ClasspathHelper.forPackage("my.package"),new TypeAnnotationsScanner());
Set<Class<?>> annotated = reflections.getTypesAnnotatedWith(Api.class);
If I run the server from Eclipse everything works fine and getTypesAnnotatedWith
is returning the correct classes. But If I run the server from command-line I am getting classes outside that package. Classes from the Swagger library.
I am trying to find out what is going on instead of making a wolk-around
Thanks in advance!
I finally solve this just using the java ClassLoader. Some spaghetti code! Sorry..