我正在尝试使用OpenJDK 15、Spring Boot 2.6.0、Springfox 3 启动 Spring Boot 项目。
我们正在做一个项目,取代Netty作为 Web 服务器并使用 Jetty 来代替,因为我们不需要非阻塞环境。
在代码中我们主要依赖Reactor API(Flux、Mono),所以我们无法删除org.springframework.boot:spring-boot-starter-webflux依赖。
我在一个新项目中复制了我们遇到的问题:https://github.com/jvacaq/spring-fox。
我发现build.gradle文件中的这些行是问题的根源。
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-jetty")
Run Code Online (Sandbox Code Playgroud)
这是build.gradle文件:
plugins {
id 'org.springframework.boot' version '2.6.0'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-jetty")
implementation 'org.springframework.boot:spring-boot-starter-webflux'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
implementation "io.springfox:springfox-boot-starter:3.0.0" …Run Code Online (Sandbox Code Playgroud) 无法呈现此定义。提供的定义未指定有效的版本字段。
请指出有效的Swagger或OpenAPI版本字段。支持的版本字段是大写字母:“ 2.0”以及与openapi相匹配的字段:3.0.n(例如,openapi:3.0.0)。
我需要在哪里插入正确的版本来停止以下错误。Swagger编辑器工作正常,但是在启动特定项目时收到此错误。非常感谢
我正在为我的应用程序使用 spring 数据休息。
当我在存储库中添加此方法时,出现以下错误并且应用程序无法启动:-
方法:-
@Modifying
@Transactional
@Query("from employee as ft where ft.company.id = ?1")
void deleteAllEmployeeCompany(
@Param("companyId") @RequestParam("companyId") int companyId);
Run Code Online (Sandbox Code Playgroud)
错误:-
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:874) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
更新:-
所有依赖项的列表:-
[INFO] com.test:test-service:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.4.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.4.1.RELEASE:compile
[INFO] | | …Run Code Online (Sandbox Code Playgroud) java ×2
springfox ×2
api ×1
gradle ×1
java-11 ×1
javascript ×1
spring ×1
spring-boot ×1
spring-data ×1
spring-mvc ×1
swagger ×1