本文整理汇总了Java中com.wordnik.swagger.config.ConfigFactory类的典型用法代码示例。如果您正苦于以下问题:Java ConfigFactory类的具体用法?Java ConfigFactory怎么用?Java ConfigFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigFactory类属于com.wordnik.swagger.config包,在下文中一共展示了ConfigFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import com.wordnik.swagger.config.ConfigFactory; //导入依赖的package包/类
@Override
public void init(Container container, ApiBundleConfiguration configuration) {
this.configuration = configuration;
container.registerListener(this);
SwaggerConfig config = ConfigFactory.config();
config.setApiVersion("1.0.1");
for (ConnectorConfiguration connector : container.getConfiguration().getServerConfiguration().getConnectorConfigurations()) {
if (connector.getScheme() == Scheme.http) {
config.setBasePath(connector.getScheme().toString() + "://" + getHostName() + ":" + connector.getPort());
break;
}
}
ScannerFactory.setScanner(new DefaultJaxrsScanner());
ClassReaders.setReader(new DefaultJaxrsApiReader());
FilterFactory.setFilter(new MinnalApiSpecFilter());
ModelConverters.addConverter(getExcludeAnnotationsConvertor(), true);
ModelConverters.addConverter(getOverrideConverter(), true);
}
开发者ID:minnal,项目名称:minnal,代码行数:22,代码来源:ApiBundle.java
示例2: shouldConfigureSwagger
import com.wordnik.swagger.config.ConfigFactory; //导入依赖的package包/类
@Test
public void shouldConfigureSwagger() {
ModelConverter converter = mock(ExcludeAnnotationsConvertor.class);
doReturn(converter).when(apiBundle).getExcludeAnnotationsConvertor();
OverrideConverter overrideConverter = mock(OverrideConverter.class);
doReturn(overrideConverter).when(apiBundle).getOverrideConverter();
doReturn("localhost").when(apiBundle).getHostName();
apiBundle.init(container, bundleConfiguration);
SwaggerConfig config = ConfigFactory.config();
assertEquals(config.apiVersion(), "1.0.1");
assertEquals(config.basePath(), "http://localhost:8080");
assertTrue(ScannerFactory.scanner().get() instanceof DefaultJaxrsScanner);
assertTrue(ClassReaders.reader().get() instanceof DefaultJaxrsApiReader);
assertTrue(FilterFactory.filter() instanceof MinnalApiSpecFilter);
assertTrue(ModelConverters.converters().contains(converter));
assertTrue(ModelConverters.converters().contains(overrideConverter));
}
开发者ID:minnal,项目名称:minnal,代码行数:18,代码来源:ApiBundleTest.java
示例3: startup
import com.wordnik.swagger.config.ConfigFactory; //导入依赖的package包/类
@PostConstruct
public void startup() {
for (ModelConverter modelConverter : modelConverters) {
ModelConverters.addConverter(modelConverter, true);
}
ConfigFactory.setConfig(swaggerConfig);
ScannerFactory.setScanner(jaxrsScanner);
ClassReaders.setReader(jaxrsApiReader);
}
开发者ID:cerner,项目名称:beadledom,代码行数:11,代码来源:SwaggerModule.java
示例4: init
import com.wordnik.swagger.config.ConfigFactory; //导入依赖的package包/类
@Override
public void init(ServletConfig servletConfig) {
try {
super.init(servletConfig);
SwaggerConfig swaggerConfig = new SwaggerConfig();
ConfigFactory.setConfig(swaggerConfig);
swaggerConfig.setBasePath("http://localhost:8080/crol");
swaggerConfig.setApiVersion("1.0.0");
ScannerFactory.setScanner(new DefaultJaxrsScanner());
ClassReaders.setReader(new DefaultJaxrsApiReader());
} catch (ServletException e) {
System.out.println(e.getMessage());
}
}
开发者ID:CityOfNewYork,项目名称:CROL-WebApp,代码行数:15,代码来源:SwaggerJaxrsConfig.java
示例5: init
import com.wordnik.swagger.config.ConfigFactory; //导入依赖的package包/类
@Override
public void init(ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
SwaggerConfig config = new SwaggerConfig();
ConfigFactory.setConfig(config);
ScannerFactory.setScanner(new DefaultJaxrsScanner());
ClassReaders.setReader(new JerseyApiReader());
}
开发者ID:nesl,项目名称:SensorSafe,代码行数:10,代码来源:SensorSafeSwaggerConfig.java
示例6: registerSwagger
import com.wordnik.swagger.config.ConfigFactory; //导入依赖的package包/类
private void registerSwagger(Environment environment, RestwarsConfiguration configuration) {
SwaggerConfig swagger = ConfigFactory.config();
swagger.setApiVersion("1.0.0");
swagger.setBasePath(configuration.getPublicUrl());
environment.jersey().register(new ApiListingResourceJSON());
environment.jersey().register(new ResourceListingProvider());
environment.jersey().register(new ApiDeclarationProvider());
ScannerFactory.setScanner(new DefaultJaxrsScanner());
ClassReaders.setReader(new DefaultJaxrsApiReader());
FilterFactory.setFilter(new SwaggerFilter());
}
开发者ID:phxql,项目名称:restwars,代码行数:14,代码来源:RestwarsApplication.java
示例7: setBasePath
import com.wordnik.swagger.config.ConfigFactory; //导入依赖的package包/类
public static void setBasePath(String basePath) {
SwaggerConfig config = ConfigFactory.config();
config.setBasePath(basePath);
ConfigFactory.setConfig(config);
}
开发者ID:nesl,项目名称:SensorSafe,代码行数:6,代码来源:SensorSafeSwaggerConfig.java
注:本文中的com.wordnik.swagger.config.ConfigFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论