Hi,
I’m adding Swagger to an existing Java API code, using Jersey. It’s configured and I can access the swagger.json, but it doesn’t detect any resource,
Here's the code I use for configuration:
@Component
//Spring default path, uncomment to change
//@ApplicationPath("")
public class JerseyConfiguration extends ResourceConfig {
public JerseyConfiguration() {
super.packages("com.app.api");
super.register(ApiListingResource.class);
super.register(SwaggerSerializers.class);
//
//Swagger API definition
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.2");
beanConfig.setSchemes(new String[]{"http"});
beanConfig.setHost("localhost:8080");
beanConfig.setBasePath("/api");
beanConfig.setResourcePackage("io.swagger.resources");
beanConfig.setScan(true);
beanConfig.setPrettyPrint("true");
}
}
Here's what I get in the console
i.s.jaxrs.listing.ApiListingResource : using scanner io.swagger.jaxrs.config.BeanConfig@1b670f24
org.reflections.Reflections : given scan urls are empty. set urls in the configuration
I guess Swagger just doesn't know what to scan, but super.packages("com.app.api"); should be enough.
How can I specify resources in this configuration?
PS: Swagger-maven-plugin works well and detects my resources.
Also, I'm confused by the Host and BasePath config": what are they for? Are they supposed to indicate an existing Swagger UI server where the API would be available?
thanks
Jean
beanConfig.setResourcePackage("io.swagger.resources");
--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-------------------------------------------http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------
--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.