公司内部测试需要dubbo接口提供文档, 实习的闲暇之余有好奇Swagger2的代码,看看它怎么大致的流程如何,后面又希望能灵活调试 。由此想到基于springfox swagger2来实现一个类似swagger http文档的dubbo文档。
github上也有类似功能的项目, 不过项目存在问题并且作者也没有维护
https://github.com/zhaojigang/springfox
动态生成带注解的Controller来进行api信息的读取,但是个人感觉这个做法不是特别优雅,springfox官方已经提供了一套扩展性比较强的接口来可以实现api信息的读取。
依旧支持官方的swagger ui
UI页面支持
<dependencies>
<dependency>
<groupId>com.github.uhfun</groupId>
<artifactId>swagger-more-annotations</artifactId>
<version>1.0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.uhfun</groupId>
<artifactId>swagger-more-core</artifactId>
<version>1.0.2-SNAPSHOT</version>
</dependency>
</dependencies>
1.0.1-SNAPSHOT Demo 1.0.2-SNAPSHOT Demo 移步wiki or 博客
1.0.0
Copyright (c) 2019 uhfun
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.