SpringBoot多模块使用Swagger2 3.0

本文介绍了如何在SpringBoot项目中实现多模块架构,并使用Swagger2的3.9版本进行API文档管理。首先,在父项目创建common模块,接着在common模块下建立swaggerconfig子模块,用于配置Swagger。然后,在需要使用Swagger的模块添加相关依赖,并在Controller中添加注解。最后,通过访问http://localhost:8761/swagger-ui/index.html或增强版http://localhost:8761/doc.html来查看和使用Swagger-UI。
摘要由CSDN通过智能技术生成

在父项目里创建common模块

本次使用的是swagger2 的3.9版本,创建common模块来配置swagger是为后续多模块用swagger准备的。

pom.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>springcloud-eureka</artifactId>
        <groupId>com.example</groupId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <modules>
        <module>swagger-config</module>
    </modules>

    <groupId>com.kevin</groupId>
    <artifactId>common</artifactId>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
    </properties>
    <dependencies>
        <!--swagger-->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值