我正在尝试使用下拉向导+ swagger来拥有一个rest -- api...and --这是文档。
我发现的问题是,在初始化为文档服务的资源时,swagger需要设置一个"basePath“属性:
@Override
public void run(MyServiceConfiguration configuration, Environment environment) throws Exception {
...
...
// Set the swagger config options
SwaggerConfig config = ConfigFactory.config();
config.setApiVersion("1.0.0");
config.setBasePath("http://localhost:9090/api");我可以从配置参数中获取端口和根路径。但是,在我使用服务运行方法时,是否有任何方法实际获得协议+主机名?
发布于 2014-04-21 14:49:36
尝试设置如下相对路径:
config.setBasePath(".." + environment.getApplicationContext().getContextPath());https://stackoverflow.com/questions/23188050
复制相似问题