jakartaee / servlet

Jakarta Servlet
https://eclipse.org/ee4j/servlet
Other
250 stars 79 forks source link

Circular dependency between AttributeConverter and JPA #659

Closed TofanMihai closed 2 weeks ago

TofanMihai commented 2 weeks ago

Upon migrating to Jakarta EE and upgrading to Spring 3.0+, we've noticed that the EntityManagerFactory defined in HibernateJpaConfiguration is causing a circular dependency issue with our converters.

Specifically, any custom converter implementing the AttributeConverter interface can no longer have JPA repositories injected into it because they form a cyclic dependency.

┌─────┐ | entityManagerFactory defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class] ↑ ↓ | customConverter impkementing jakarta.persistence.AttributeConverter<T,M> ↑ ↓ | xService defined in xProject ↑ ↓ | xRepository defined in xProject defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration ↑ ↓ | jpaSharedEM_entityManagerFactory └─────┘

markt-asf commented 2 weeks ago

Not a Jakarta Servlet issue.