Fix bug about no bean found of type feign.codec.Encoder in Spring Boot 4#49457
Open
Copilot wants to merge 5 commits into
Open
Fix bug about no bean found of type feign.codec.Encoder in Spring Boot 4#49457Copilot wants to merge 5 commits into
feign.codec.Encoder in Spring Boot 4#49457Copilot wants to merge 5 commits into
Conversation
3 tasks
…bility Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix azure-spring-data-cosmos fails with OpenFeign on Spring Boot 4
fix(azure-spring-data-cosmos): add spring-boot-data-commons to fix OpenFeign encoder failure on Spring Boot 4
Jun 11, 2026
feign.codec.Encoder in Spring Boot 4
Adds OpenFeignEncoderBeanRegistrationUnitTest which loads OpenFeign's FeignClientsConfiguration on the azure-spring-data-cosmos classpath and asserts a feign.codec.Encoder bean (PageableSpringEncoder) is registered. Without the spring-boot-data-commons dependency the bean is missing, reproducing issue #49441.
Member
|
/azp java - spring - tests |
|
Command 'java' is not supported by Azure Pipelines. Supported commands
See additional documentation. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a Spring Boot 4 + Spring Cloud OpenFeign 5.0.1 startup failure when azure-spring-data-cosmos is on the classpath, where OpenFeign doesn’t register any feign.codec.Encoder due to conditional configuration not matching after DataWebProperties moved to spring-boot-data-commons.
Changes:
- Add
org.springframework.boot:spring-boot-data-commons:4.0.6as a main dependency (and JPMSrequires) so OpenFeign’s@ConditionalOnClass({ Pageable.class, DataWebProperties.class })path can activate. - Add a focused regression test that loads
FeignClientsConfigurationand asserts anEncoderbean is present (and isPageableSpringEncoder). - Register the new external dependencies and document the fix in the module changelog.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/config/OpenFeignEncoderBeanRegistrationUnitTest.java | Adds regression coverage ensuring OpenFeign registers an Encoder on the azure-spring-data-cosmos classpath under Spring Boot 4. |
| sdk/spring/azure-spring-data-cosmos/src/main/java/module-info.java | Adds the JPMS requirement for spring.boot.data.commons so the module resolves it on the module path. |
| sdk/spring/azure-spring-data-cosmos/pom.xml | Adds spring-boot-data-commons as a main dependency and adds OpenFeign starter for the regression test; updates enforcer includes accordingly. |
| sdk/spring/azure-spring-data-cosmos/CHANGELOG.md | Documents the bug fix in the Unreleased section. |
| eng/versioning/external_dependencies.txt | Registers spring-boot-data-commons and spring-cloud-starter-openfeign in the external dependencies list. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Member
|
/azp run java - spring - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Using
azure-spring-data-cosmoswithspring-cloud-starter-openfeign:5.0.1on Spring Boot 4 fails at startup withjava.lang.IllegalStateException: No bean found of type interface feign.codec.Encoder.Root cause: OpenFeign 5.0.1's
FeignClientsConfigurationhas two encoder bean paths:SpringEncoder— guarded by@ConditionalOnMissingClass("org.springframework.data.domain.Pageable")→ skipped becauseazure-spring-data-cosmostransitively pulls inspring-data-commonswhich containsPageablePageableSpringEncoder(inSpringDataConfiguration) — guarded by@ConditionalOnClass({ Pageable.class, DataWebProperties.class })→ skipped becauseDataWebPropertiesmoved fromspring-data-commonstospring-boot-data-commonsin Spring Boot 4, which was not on the classpathNeither path fires → no
Encoderbean → startup failure.Changes
azure-spring-data-cosmos/pom.xml: Addspring-boot-data-commons:4.0.6as a compile dependency. This putsDataWebPropertieson the classpath, enabling OpenFeign'sSpringDataConfigurationconditional to pass andPageableSpringEncoderto be registered.module-info.java: Addrequires spring.boot.data.commons.eng/versioning/external_dependencies.txt: Registerspringboot4_org.springframework.boot:spring-boot-data-commons;4.0.6.CHANGELOG.md: Document the fix.