Spring boot GatewayAutoConfiguration需要找不到类型为org.springframework.http.codec.servercodeconfigurer的bean
我想设置我创建的所有服务之间的通信。 当我在项目中添加cloud config server gradle依赖项并运行 我得到的这类问题的项目 根据我的知识,我已经正确地定义了一切,但我不是 能够找到过去两天的问题。我自己尝试 这些是我在这个项目中创建的文件 build.gradle.kts bootsrap.ymlSpring boot GatewayAutoConfiguration需要找不到类型为org.springframework.http.codec.servercodeconfigurer的bean,spring-boot,kotlin,microservices,api-gateway,Spring Boot,Kotlin,Microservices,Api Gateway,我想设置我创建的所有服务之间的通信。 当我在项目中添加cloud config server gradle依赖项并运行 我得到的这类问题的项目 根据我的知识,我已经正确地定义了一切,但我不是 能够找到过去两天的问题。我自己尝试 这些是我在这个项目中创建的文件 build.gradle.kts bootsrap.yml *************************** APPLICATION FAILED TO START *************************** Descr
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method modifyRequestBodyGatewayFilterFactory in org.springframework.cloud.gateway.config.GatewayAutoConfiguration required a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' in your configuration.
Process finished with exit code 1
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "2.4.5"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
kotlin("jvm") version "1.4.32"
kotlin("plugin.spring") version "1.4.32"
}
group = "com.main"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_11
repositories {
mavenCentral()
}
extra["springCloudVersion"] = "2020.0.2"
dependencies {
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.springframework.cloud:spring-cloud-config-server")
implementation("org.springframework.cloud:spring-cloud-starter-gateway")
implementation("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
dependencyManagement {
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
package com.main.apigateway
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.cloud.netflix.eureka.EnableEurekaClient
@SpringBootApplication
@EnableEurekaClient
class ApigatewayApplication
fun main(args: Array<String>) {
runApplication<ApigatewayApplication>(*args)
}
server:
port: 8999
spring:
application:
name: api-gateway
cloud:
gateway:
routes:
- id: DEPARTMENT-SERVICE
uri: lb://DEPARTMENT-SERVICE
predicates:
- Path=/departments/**
- id: USER-REGISTRATION
uri: lb://USER-REGISTRATION
predicates:
- Path=/users/**
spring:
cloud:
config:
enabled: true
uri: http://localhost:9296