本文整理汇总了Java中com.wordnik.swagger.config.ConfigFactory.config方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigFactory.config方法的具体用法?Java ConfigFactory.config怎么用?Java ConfigFactory.config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.wordnik.swagger.config.ConfigFactory
的用法示例。
在下文中一共展示了ConfigFactory.config方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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));
}
示例3: 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());
}
示例4: setBasePath
import com.wordnik.swagger.config.ConfigFactory; //导入方法依赖的package包/类
public static void setBasePath(String basePath) {
SwaggerConfig config = ConfigFactory.config();
config.setBasePath(basePath);
ConfigFactory.setConfig(config);
}