Skip to content

Migrating from Spring 6.1.x to 6.2.x leads to exceptions in a Pekko setup #34303

Closed
@gmarfia88

Description

@gmarfia88

I am working on a Jakarta EE application that uses Spring Framework (not Spring Boot). After upgrading the spring-framework-bom version from 6.1.16 to 6.2.x, the following issues have emerged:

  1. Issue with injecting generic beans. Some beans defined with generics are no longer injected correctly. For example:

    @Bean public MyInterface myBean() { return new MyClass<>(); } // raw type definition

    bean injected as follows:

    @Qualifier("myBean") @Autowired private MyClass<MyObject> myBean; // MyClass implements MyInterface

    This generates an exception stating that no bean of type MyClass exists.

  2. Random errors during deployment. In some cases, the application deployment fails with the following exception: Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'exampleBean': Requested bean is currently in creation: Is there an unresolvable circular reference or an asynchronous initialization dependency?

    The issue is non-deterministic: in subsequent deployments, the exception is reported for different beans. I have verified that these issues have been reported and tracked in the official Spring Framework tickets: Migrating spring 6.1.x to 6.2.x leads to BeanCurrentlyInCreationException #34271 and BeanCurrentlyInCreationException is thrown when multiple threads simultaneously try to create bean #34186

  3. Java Config injection sometimes fails. In certain cases, the injection of a Java Config class fails. For example:

    @Autowired private MyJavaConfig myJavaConfig;

    @Bean public MyBuilder myBuilder() { return new MyBuilder(this.myJavaConfig.serviceFactory()); }

    This generates the following exception: Caused by: java.lang.NullPointerException: Cannot invoke "MyJavaConfig.serviceFactory()" because "this.myJavaConfig" is null

These issues occur randomly, and I have not been able to reproduce them in a greenfield project. However, reverting to version 6.1.16 of Spring Framework resolves the deployment issues.

Has anyone encountered similar problems with Spring Framework 6.2.x, or does anyone have suggestions on how to address these cases?

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: feedback-providedFeedback has been providedtype: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions