Describe the bug Opened as requested by https://github.com/spring-projects/spring-boot/issues/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.
Comment From: OlgaMaciaszek
@trcoelho thanks for reporting the issue.
This actually is the way the FactoryBean.OBJECT_TYPE_ATTRIBUTE should be set for both MockBean and AOT to work correctly; there was, in fact no problem with AOT, but, instead, an over-eager assertion in the AOT tests. After reverting this change and fixing the test, the regression is now fixed.