-
Notifications
You must be signed in to change notification settings - Fork 37.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple datasources with JPA repositories fails with generated AOT artifacts #29595
Comments
Hi I am also having a similar issue, which I've been trying to solve for two days already. In my case it is not detecting the Entity. Thus, it is throwing UnsatisfiedDependencyException The SomeEntity (annotated by @entity) is used in SomeRepository (annotated by @repository). Also in my case, the project is able to start in SB 3.0.0 without the native support.
|
@pnijem, the behavior you have described sounds like it might be a separate issue. Would you mind creating a new issue to discuss that particular failure (including a sample application which demonstrates the behavior)? |
Thanks for the report and the sample @svenm1982 and sorry it took so long. There's now a fix for this in Duplicates #30476. There might be some work needed in terms of supporting multiple datasources, see spring-projects/spring-data-jpa#2753 (comment). |
I don't know if it helps but I came across the "not a managed type" error when running a native spring-boot app with multiple databases, too. Turns out to be a configuration issue on my side. See issue 39266. Here is my sample repo of a working native application which demonstrates how to setup custom datasources and run multiple databases. |
Overview
Spring Boot Version: >= 3.x.x
I have a project with multiple JPA DataSources over multiple configuration classes using
@EnableJpaRepositories
.The project runs normally with Spring Boot 3.0.0 without native support, but when I generate the AOT classes and run with
-Dspring.aot.enabled=true
, the repository beans can not be resolved and the application does not start.Steps to Reproduce
I created an demo/sample project (multijpa.zip) with two H2 databases and two configs with one repository and an entity each and a tiny
RestController
which will autowire the two repositories.graddle aotClasses
generationMultijpaApplication
with-Dspring.aot.enabled=true
JVM ParameterThe text was updated successfully, but these errors were encountered: