io.swaggerを使用してswaggerとcxfを統合

2445 ワード

io.swagger(1.5.2)集積cxf(2.7.18)spring(3.2.7.RELEASE)struts 2(2.3.36)
一:参考文献:
https://github.com/swagger-api/swagger-samples/blob/master/java/java-jaxrs-cxf/src/main/webapp/index.html
https://github.com/swagger-api/swagger-samples/tree/master/java/java-resteasy-spring/src/main/webapp/WEB-INF
https://github.com/swagger-api/swagger-ui/tree/2.x/dist
二:配置
pom.xml
		
		
            io.swagger
            swagger-jaxrs
            1.5.2
              
	              
	                javax.validation
				    validation-api
	            
        	 
        

コピーhttps://github.com/swagger-api/swagger-ui/tree/2.x/distのページをプロジェクトに移動し、構成に従ってswagger.index.htmlのurlを変更します.
义齿
    cxf-service.xml増加
	
	
	
	
        
        
        
        
        
        
        
    

	
		
			
		
        
			
		
	

ここではサービスインタフェースを提供するサービスについて,@Path,@Api,@ApiOperationなどの注釈を用いる.
3:エラー:
1.5.0エラーの使用
Failed to scan JAR [file:/Users/wangql/deploy/gppmm/ppmm/WEB-INF/lib/jackson-dataformat-xml-2.4.2.jar] from WEB-INF/lib
java.util.zip.ZipException: error in opening zip file
1.5.9を使用してエラーを報告
JAvax/validation/constraints/Sizeが見つかりません
四:cxf-3.xの場合、参照
https://github.com/apache/cxf/tree/3.0.x-fixes/distribution/src/main/release/samples/jax_rs.
http://cxf.apache.org/docs/swagger2feature.htm
2.xの構成方式を用いても実現できると推定される.具体的にはテストしていません