本文整理汇总了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);
}
示例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: 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);
}
示例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());
}
}
示例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());
}
示例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());
}
示例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);
}