3

I am getting the below error in my program after adding the below maven dependencies.

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.2.2.RELEASE</version>

Error

Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.http.codec.ServerCodecConfigurer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

Action:

Consider defining a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' in your configuration.

Please suggest how to create org.springframework.http.codec.ServerCodecConfigurer.


The issue is solved by adding the below code.

@Bean
public ServerCodecConfigurer serverCodecConfigurer() {
   return ServerCodecConfigurer.create();
}
7
  • See: stackoverflow.com/questions/52447223/… or you could just do a search on org.springframework.http.codec.ServerCodecConfigurer. .
    – cliff2310
    Commented Jan 9, 2020 at 17:09
  • Share the relevant code with more details and stacktrace Commented Jan 9, 2020 at 17:58
  • Share your full pom.xml Commented Jan 9, 2020 at 22:21
  • did u try link provided by @cliff2310 Commented Jan 10, 2020 at 2:43
  • I have checked @cliff2310 link. I can't figure out how to execute that compile code. Can you please suggest.
    – ITIB
    Commented Jan 10, 2020 at 3:05

1 Answer 1

6

In my case, it was caused by having both spring-boot-starter-web and spring-cloud-starter-gateway in my dependencies.

At the time of writing, both projects are not compatible: https://github.com/spring-cloud/spring-cloud-gateway/issues/319

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.