1.建立spring boot項目
2.導入jar
<!-- 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>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<artifactId>springfox-swagger2</artifactId>
3.編寫一個Hello 工程
4.配置swagger ==>Config
@Configurationbr/>@EnableSwagger2//開啟swagger2
public class SwaggerConfig {
}
5.測試運作:
http://127.0.0.1:8080/swagger-ui.html