Kotlin создать приложение Webflux без каких-либо MVC зависимостей - PullRequest
0 голосов
/ 06 августа 2020

Я хочу создать проект, используя kotlin и webflux. Приложение запускается без проблем, но когда я запускаю тесты интеграции Spring, я получаю сообщение об ошибке:

caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'conversionServicePostProcessor' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Cannot register bean definition [Root bean: class [org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=conversionServicePostProcessor; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]] for bean 'conversionServicePostProcessor': There is already [Root bean: class [org.springframework.security.config.annotation.web.reactive.WebFluxSecurityConfiguration];

Я знаю, что это происходит при использовании spring mvc и webflux, но мой build.gradle выглядит так:

dependencies {
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
implementation ("com.okta.spring:okta-spring-boot-starter:1.4.0")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.retry:spring-retry")
implementation("org.springframework.boot:spring-boot-starter-data-mongodb-reactive")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation ("com.playtika.reactivefeign:feign-reactor-spring-configuration:2.0.13")
implementation ("com.playtika.reactivefeign:feign-reactor-webclient:2.0.13")
implementation ("com.playtika.reactivefeign:feign-reactor-cloud:2.0.13")
implementation ("com.github.arkadiuszSzast:reactive-logstash-logging-starter:1.0.7")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("org.springframework.cloud:spring-cloud-starter-config")
implementation("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client")
implementation("io.micrometer:micrometer-registry-prometheus")
developmentOnly("org.springframework.boot:spring-boot-devtools")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
    exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
}
testImplementation("io.projectreactor:reactor-test")
testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc")
testImplementation ("com.playtika.testcontainers:embedded-mongodb:1.78")
testImplementation ("org.springframework.security:spring-security-test")
}

Не знаю, где может быть скрытая пружинная mvc зависимость. На данный момент я исправил это, установив свойство spring.main.web-application-type, но я хочу удалить зависимость mvc, а не устанавливать его таким образом.

...