本文整理汇总了Java中com.wordnik.swagger.config.ScannerFactory类的典型用法代码示例。如果您正苦于以下问题:Java ScannerFactory类的具体用法?Java ScannerFactory怎么用?Java ScannerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScannerFactory类属于com.wordnik.swagger.config包,在下文中一共展示了ScannerFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import com.wordnik.swagger.config.ScannerFactory; //导入依赖的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.ScannerFactory; //导入依赖的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.ScannerFactory; //导入依赖的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.ScannerFactory; //导入依赖的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.ScannerFactory; //导入依赖的package包/类
@Override
public void init(final ServletConfig servletConfig) {
super.init(servletConfig);
final ReflectiveJaxrsScanner reflectiveJaxrsScanner = new ReflectiveJaxrsScanner();
final String resourcePackageParam = servletConfig.getInitParameter("resourcePackage");
if(StringUtils.isEmpty(resourcePackageParam)) {
log.warn("Please specify the resourcePackage init parameter and point it to the package of your webservice resources");
}
reflectiveJaxrsScanner.setResourcePackage(resourcePackageParam);
ScannerFactory.setScanner(reflectiveJaxrsScanner);
}
开发者ID:jreijn,项目名称:hippo-addon-restful-webservices,代码行数:12,代码来源:ReflectiveJaxrsConfig.java
示例6: init
import com.wordnik.swagger.config.ScannerFactory; //导入依赖的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
示例7: registerSwagger
import com.wordnik.swagger.config.ScannerFactory; //导入依赖的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
注:本文中的com.wordnik.swagger.config.ScannerFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论