Closed KhanamDEV closed 11 months ago
I'm unable to reproduce the exception from the code you provided. Can you revisit your arrangement and provide a minimal yet complete sample that reproduces the problem? You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
@mp911de thanks for reply, i resolved my problem. This is my error.
Thanks for coming back. Out of curiosity, can you share a bit on how you managed to create that exception?
Thanks for coming back. Out of curiosity, can you share a bit on how you managed to create that exception?
@KhanamDEV that would indeed have been great as I just got the exact same error message and such help would be highly appreciated.
Just to document my observation:
SpringBootApplication
with @EnableJpaRepositories
@Import(JpaRepositoriesRegistrar.class)
JpaRepositoryConfigExtension
entityManager
here and here.I am using:
3.2.1
what gives me spring-data-jpa 3.2.1
6.4.0.Final
With spring-boot 2.x
I always had hibernate-entitymanager
as dependency to make it work.
However, in the new org.hibernate.orm
there are only alpha versions available:
https://repo1.maven.org/maven2/org/hibernate/orm/hibernate-entitymanager/
Whether I add this alpha version dependency additionally to hibernate-core
or not does not seem to make a difference for the error I am getting.
I am slightly confused that migration guides on baeldung, medium nor the hibernate homepage does not say a word about this.
However, according to this I see that actually hibernate-core
should be just sufficient.
Anyhow for me the automagic of spring-boot seems to fail boostraping the entitymanager for hibernate causing this error.
Is there an official spring-data-jpa sample based on the recent spring-boot
that I could use to see if that works and then can compare this with my project to figure out the difference?
Is there an official spring-data-jpa sample based on the recent spring-boot that I could use
https://spring.io/guides/gs/accessing-data-jpa/ https://github.com/spring-guides/gs-accessing-data-jpa/blob/main/complete/pom.xml
OK, got it: Stupid me, I was missing this dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
Before I had this dependency:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
So hopefully this may help if others run into the same error.
Hi team, I have some issue when using
AbstractRoutingDataSource
for customdatasource
: This is my error:Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtAuthenticationFilter' defined in file [JwtAuthenticationFilter.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'authenticationService' defined in file [AuthenticationService.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'userRepositoryInterface' defined in com.tkg.MasterSystem.repositories.UserRepositoryInterface defined in @EnableJpaRepositories declared on DatasourceRoutingConfiguration: Cannot resolve reference to bean 'jpaSharedEM_entityManager' while setting bean property 'entityManager'
This is my config: