【发布时间】:2021-08-25 15:08:42
【问题描述】:
喂!对不起我的英语,但这不是我的母语。我正在尝试制作一个项目来练习 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')
}
实现层:什么都没有
我仍然没有任何东西实现只是一个带有测试端点的控制器,只是为了看看招摇是否在工作:
我按照文档创建了这个类,但我不确定在哪里使用它:
设置中会缺少什么?
有人可以澄清我的问题吗?非常感谢。
忘了说构建项目正常,服务上去Postman返回200。
【问题讨论】:
标签: java spring spring-boot swagger spring-webflux