You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My Solution:
Instead use boardJpaRepositoryImpl, use boardRepositoryImpl (or jpaBoardRepositoryImpl). it worked to solve problem.
(I wanted to create repository implementations, both with and without using JPA. That's why I didn't use the name BoardRepositoryImpl. Instead, I intended to use BoardJpaRepositoryImpl to signify an implementation using JPA. I'm curious if there are any rules against using the combination of a Spring Data JPA interface and its corresponding impl class in situations like this.)
additionally, I tried to search spring data jpa documentation, and I knew about repositoryImplementationPostfix. Is there any connection with this?
thanks to check this issue, and I apologize if this problem too much similar previous issues.
The text was updated successfully, but these errors were encountered:
You cannot inject a repository facade into its own repository fragment as this creates a circular dependency. You could make the repository @Lazy or inject an ObjectProvider< BoardJpaRepository> to defer object resolution to a time after the objects are constructed.
You cannot inject a repository facade into its own repository fragment as this creates a circular dependency. You could make the repository @Lazy or inject an ObjectProvider< BoardJpaRepository> to defer object resolution to a time after the objects are constructed.
In summary your answer, if the Spring Data JPA interface is named BoardRepository, creating an Impl instance containing this name (ex: BoardRepositoryImpl) may result in a circular reference issue?
@mp911de Upon referring to the official Spring Data JPA documentation, it is confirmed that a UserRepository, inheriting from CrudRepository, can have a custom implementation named UserRepositoryImpl. However, there doesn't seem to be information about @Lazy or circular reference in the documentation.
If it is not inconvenient, could you provide additional explanation or example?
I realized myself. In official documents, did not use the Spring Data JPA interface to process CRUD where used it as an implementation, but instead used the EntityManager.
In my situation, on the other hand, I referred to the Spring Data JPA interface where I used it as an implementation of Spring Data JPA.
I realized that the basic strategy of the Spring Data JPA implementation would eventually lead to a self-reference, which would result in a reference to my own interface.
I was able to find out by myself, but I'm sorry for the issue.
First, I checked about two issue: #2384 , and this.
but I solve this problem by another way, I don't know why this way solved problem.
could I know Spring data JPA internal principle?
this is my example code.
With:
Error:
My Solution:
Instead use
boardJpaRepositoryImpl
, useboardRepositoryImpl
(orjpaBoardRepositoryImpl
). it worked to solve problem.(I wanted to create repository implementations, both with and without using JPA. That's why I didn't use the name BoardRepositoryImpl. Instead, I intended to use BoardJpaRepositoryImpl to signify an implementation using JPA. I'm curious if there are any rules against using the combination of a Spring Data JPA interface and its corresponding
impl
class in situations like this.)additionally, I tried to search spring data jpa documentation, and I knew about
repositoryImplementationPostfix
. Is there any connection with this?thanks to check this issue, and I apologize if this problem too much similar previous issues.
The text was updated successfully, but these errors were encountered: