itsource

원두형의 원두. 원두형. 원두형. 원두형. 원두형. 원두형.ServerCodecConfigurer'를 찾을 수 없습니다.

mycopycode 2023. 7. 21. 21:36
반응형

원두형의 원두. 원두형. 원두형. 원두형. 원두형. 원두형.ServerCodecConfigurer'를 찾을 수 없습니다.

응용 프로그램 시작 실패


설명:

메서드의 매개 변수 0modifyRequestBodyGatewayFilterFactoryorg.springframework.cloud.gateway.config.GatewayAutoConfiguration유형의 콩이 필요한.'org.springframework.http.codec.ServerCodecConfigurer'찾을 수 없습니다.

작업:

유형의 콩을 정의하는 것을 고려합니다.'org.springframework.http.codec.ServerCodecConfigurer'사용자 구성에서.

JAVA_를 선택했습니다.TOOL_OPTIONS: -agentlib:jvmhook
_JAVA_OPTIONS 선택: -Xbootclasspath/a:"C:\프로그램 파일(x86)\HPE\통합 기능 테스트\bin\java_shared\classes\jasmin.jar"
JAVA_를 선택했습니다.TOOL_OPTIONS: -agentlib:jvmhook

아래 코드를 추가해 보십시오.그것은 나에게 효과가 있었다.

@Bean
public ServerCodecConfigurer serverCodecConfigurer() {
   return ServerCodecConfigurer.create();
}

다음과 같이 시도할 수 있습니다.

  compile ('org.springframework.cloud:spring-cloud-starter-gateway'){
        exclude module : 'spring-cloud-starter'
        exclude module : 'spring-boot-starter-webflux'
    }

Spring Cloud 버전을 구축할 때도 동일한 문제가 있었습니다.2020.0.0그리고.Keycloak보아하니 그것은Keycloakjar 파일은 다음에 대한 종속성을 포함합니다.spring-boot-start-web기본값을 포함하지 않도록 Maven에게 지시spring-boot-start-web다음과 같이 그 문제를 해결했습니다.

<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-spring-boot-starter</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </exclusion>
    </exclusions>
</dependency>

하지만 저는 메이븐에 대한 의존성을 포함시켜야 했습니다.servlet의 몇 가지 다른 요구 사항을 해결하기 위한 병.Keycloak다음과 같이:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>4.0.1</version>
 </dependency>

동일한 문제이지만 해결 방법은

@Bean
public ServerCodecConfigurer serverCodecConfigurer() {
   return ServerCodecConfigurer.create();
}

문제를 숨기고 응용프로그램을 컴파일합니다.어쨌든 내 게이트웨이가 제대로 작동하지 않게 만들었습니다.에서 정의한 대로 요청해도 전달, 기록 및 응답이 없습니다.yamlURL. 애플리케이션이 시작된 지 얼마 되지 않았습니다.

나의 경우 문제는spring-boot-start-web의존.우연히도 저는 그것을 발견하지 못했습니다. 왜냐하면 제 프로젝트 구조에서, 저의build.gradle"상위"에 의해 상속되고 해당 상위가 구현됨spring-boot-start-web부차적인

해당 종속성을 제거했고 요청이 올바르게 전달되었으며 로그가 표시되었습니다.내가 제거한 태니@Bean와 함께ServerCodecConfigurer .

그것이 같은 상황에 있는 누구에게나 도움이 되기를 바랍니다.

구성: 스프링 부트: 2.4.4
봄구름: 2020.0.2

저에게 문제는 의존성을 추가한 것이었습니다.

<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-core</artifactId>
    <version>10.1.0-M4</version>
</dependency>

Reactive Spring을 사용하는 경우 주의하십시오.나는 필요했습니다.HttpServletRequest이 의존성에서, 하지만 지금은 사용하고 있습니다.ServerHttpRequest부터org.springframework.http.server.reactive.

에서application.properties파일, 이 속성 설정spring.main.web-application-type=reactive.

언급URL : https://stackoverflow.com/questions/52447223/bean-of-type-org-springframework-http-codec-servercodecconfigurer-that-could-n

반응형