spring-cloud / spring-cloud-release

Spring Cloud Release Train - dependency management across a wide range of Spring Cloud projects.
http://projects.spring.io/spring-cloud
Apache License 2.0
874 stars 179 forks source link

Null fields in proxies after upgrading to Spring Cloud 2023.0.2 and Spring Boot 3.3.1 #289

Closed mgaceanu closed 2 months ago

mgaceanu commented 2 months ago

I don't know if this is the right repo for this bug report. Anyway, here it goes:

Describe the bug I have an integration test that fails after upgrading to Spring Cloud 2023.0.2 and Spring Boot 3.3.1. All goes well if I revert and use 2022.0.5 / 3.0.4

The code is testing the fallback of a @Retry annotated method. While debugging the code it seems the autowired fields are null.

    @Retry(name = "retryApi", fallbackMethod = "fallbackAfterRetry")
    public String retryApi(@NotNull String param) {
        return someBean.doThis();
    }

    private String fallbackAfterRetry(String param, Exception ex) {
        fallbackBean.doThat();
        return "all retries have exhausted";
    }

and the test:

    @Test
    void retryApi() {
        Mockito.doThrow(new RuntimeException("Test exception"))
               .when(someBean)
               .doThis();

        service.retryApi("asd");

        // verify fallback
        Mockito.verify(fallbackBean).doThat();
    }

Sample I'm attaching a sample application. spring-cloud-sample.zip

Thanks, Mircea

ryanjbaxter commented 2 months ago

Other than having spring-cloud-openfeign on the classpath I don't even see you really using Spring Cloud. Does the problem also exist without Spring Cloud on the classpath?

mgaceanu commented 2 months ago

Thanks for the feedback. It's indeed not related to Spring Cloud and I'll close the issue. If anybody else stumbles upon this, the issue was occurring in resilience4j 2.1.0, but not anymore with 2.2.0 Cheers