BeanConfig incorrectly processes resourcePackage in jersey2-jaxrs module
There are 2 problems I have found:
1. If specify inner package, outer will be scanned too.
See com.wordnik.swagger.jaxrs.config.BeanConfig#classesFromContext code:
val config = new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage(resourcePackage)).setScanners(
new TypeAnnotationsScanner(), new SubTypesScanner())
new Reflections(config).getTypesAnnotatedWith(classOf[Api]).asScala.toList
ClasspathHelper.forPackage(resourcePackage) returns urls list like this:
file:/C:/all/my-backend/project1/target/classes/
file:/C:/all/my-backend/utils/target/classes/
And then search will be applied to all classes in these paths. So we can't specify package explicitly.
2. Multiple packages cannot be specified over the comma.
If use this syntax (described in wiki docs) scanner will print warning:
given scan urls are empty. set urls in the configuration
The cause of problem possibly is that classesFromContext method is not called in this case. Swagger calls beanConfig.classes() method instead. And classes() always returns empty list.
If you can provide a unit test demonstrating this, I'd be happy to look into it more.
Try this please https://github.com/elw00d/gretty-jersey-swagger-app/tree/master
Added a filter to the BeanConfig.java class which will avoid this.
see https://github.com/swagger-api/swagger-core/blob/develop_2.0/modules/swagger-jaxrs/src/main/java/com/wordnik/swagger/jaxrs/config/BeanConfig.java#L145