授权 | 开源 |
大小 | 1.29MB |
语言 | Java |
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
3、启动类中添加@EnableSwagger2注解@RestController
public class HelloController {
@GetMapping("/get")
public String get() {
return "get";
}
@PostMapping("/post")
public String post() {
return "post";
}
@RequestMapping("/hello")
public String hello() {
return "hello";
}
}
5、启动项目,并在浏览器输入http://localhost:8080/swagger-ui.html进行swagger-ui界面访问相关软件