KEMBAR78
@MockBean annotation does not find existing bean created through @FeignClient · Issue #930 · spring-cloud/spring-cloud-openfeign · GitHub
Skip to content

@MockBean annotation does not find existing bean created through @FeignClient #930

@trcoelho

Description

@trcoelho

Describe the bug
Opened as requested by spring-projects/spring-boot#38348

Using Spring Boot 3.1.5 version @MockBean annotation works charming, however after trying Spring Boot 3.2.0-SNAPSHOT with Spring Cloud 2023.0.0-SNAPSHOT without any code change, looks like it stopped working as it not mocking @Autowired objects anymore.

It looks like it affects FeignClients classes (annotated by @FeignClient).

Is this a known issue?

Sample
Please find attached a compressed folder which has two projects inside:

mockbean-31 which has 3.1.5 Spring Boot dependencies
mockbean-32 which has 3.2.0-SNAPSHOT Spring Boot dependencies
Either has same code base without any differences.

To run, just go through folder and run:

mvn test

Let me know if you have any question.

mockbeans.zip

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions