我有基本REST的wildfly swarm服务,我想用它配置swagger ui。目前它以jar开始
这是主文件
Container container = new Container();
SwaggerWebAppFraction fraction = new SwaggerWebAppFraction();
//fraction.addWebContent(System.getProperty("swarm.swagger.ui.resources"));
//fraction.addWebContent("/");
// fraction.addWebContent("swagger-webapp-ui.war" + Container.VERSION);
container.fraction(fraction);
final JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class);
deployment.addResource(Main.class);
deployment.addResource(TimeResource.class);
deployment.addResource(CORSFilter.class);
deployment.addResource(JAXRSConfiguration.class);
// Enable the swagger bits
final SwaggerArchive archive = deployment.as(SwaggerArchive.class);
// Tell swagger where our resources are
archive.setResourcePackages("org");
//archive.setTitle("Swagger Demo");
container.start();
container.deploy(deployment);
当我访问http://localhost:8080/swagger时,我只看到这种输出
{"swagger":"2.0","info":{},"basePath":"/","tags":[{"name":"time"}],"paths":{"/time/now":{"get":{"tags":["time"],"summary":"Get the current time","description":"Returns the time as a string","operationId":"get","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"string"}}}}}}}
只是json!
http://localhost:8080/swagger-ui无法访问
如何使用swagger ui正确配置或启动wildfly swarm? 哪里出错?