java - Swagger 3.0.0 + WebFlux:我的设置有什么问题或缺失?
问题描述
嗨!对不起我的英语,但这不是我的母语。我正在尝试制作一个项目来练习 webflux,但我无法让 Swagger 工作。我在 StackOverflow 和 Google 上进行了很好的搜索,但找不到解决方案。我也尝试查看SpringFox文档,但也许我不太明白。我决定向 StackOverflow 提出我的第一个问题:
我的项目设置中缺少什么以使 Swagger 工作?
build.gradle 根目录:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.1.9.RELEASE"
}
}
plugins {
id "application"
id 'java'
id 'org.springframework.boot' version '2.1.9.RELEASE'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "io.freefair.lombok" version "5.1.0"
}
dependencies {
compile project(":contract")
}
mainClassName = 'com.pocwebflux.PocWebfluxApplication'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
jcenter()
}
allprojects {
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'io.freefair.lombok'
apply plugin: 'org.springframework.boot'
group = 'com.example'
version = "1.0.0-SNAPSHOT"
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
repositories {
mavenCentral()
}
test {
useJUnitPlatform()
}
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:2.1.9.RELEASE"
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation "io.springfox:springfox-boot-starter:3.0.0"
compile 'io.springfox:springfox-swagger-ui:3.0.0'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.mockito:mockito-junit-jupiter'
testImplementation 'org.junit.jupiter:junit-jupiter-engine'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-engine'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
}
test {
useJUnitPlatform()
}
}
build.gradle 合约层:
dependencies {
implementation project(':impl')
}
impl层:没有
我仍然没有任何东西只实现带有测试端点的控制器,只是为了看看招摇是否有效:
我按照文档创建了这个类,但我不确定在哪里使用它:
设置中会缺少什么?
有人可以澄清我的问题吗?非常感谢。
我忘了说构建项目正常并且服务上升并在邮递员中返回200。
解决方案
推荐阅读
- typescript - 我该如何改进呢?使用打字稿
- visual-studio-code - 我可以在使用 Visual Studio Code 项目资源管理器定义的文件下查看成员吗?
- android - 带有 Admob 中介的 Facebook 广告显示“无法优化”
- c++ - 为什么 fstream 的读写功能会在我的程序中的两个不同点导致错误?
- mongodb - Vuejs 使用 Axios 拖动排序项并保存到 mongoDB
- javascript - 带有日期选择器的自动完成框,无需选择日期
- reactjs - 如何在 i18n 中处理不同国家/地区的相同语言?
- javascript - 单击输入标签时反转两种 React 组件文本颜色
- java - 创建 EntityManagerFactory 时出现 ArrayIndexOutOfBoundsException
- javascript - Apache2 + Socket.io 反向代理:正确的方法