若依微服务增强swagger增强集成knife4j
1.项目pom.xml中增加
<knife4j.version>3.0.3</knife4j.version>
<!-- knife4j -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-micro-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
2.swagger服务pom.xml增加
<!-- knife4j -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
我这里不写版本号会报错,不能使用统一版本,只能手动写上版本号了
3.getway服务pom.xml增加
<!-- knife4j -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-micro-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
4.gateway服务中的SwaggerProvider 类上增加注解@Primary
如果不加项目启动报错:Parameter 0 of constructor in com.carbon.gateway.handler.SwaggerHandler required a single bean, but 2 were found: