-
Notifications
You must be signed in to change notification settings - Fork 41.2k
AutoConfigurationPackage should register JPA entities #19024
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
Comments
This should already happen. In the absence of any entity scan packages, Lines 151 to 157 in 09f6758
It sounds like that's not working for you. If you'd like us to spend some more time investigating, please spend some time creating a minimal sample that demonstrates the behaviour that you have described and share it with us by zipping it up and attaching it to this issue. |
I'll give it a try. The project in question is a test harness anyway, so I'm optimistic. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
spring-entity-scan-issue.zip The linked zip above contains an example spring boot application which exemplifies the described problem. Steps to reproduce the issue:
|
In a nutshell, the problem described above was the following:
Your sample demonstrates, when you remove The intention is that you use |
I understand, that the ability of taking control for loading of all entities via |
A library that intends to contribute additional entities to an application shouldn't be using |
With no explicit configuration at all, Boot will scan the package tree starting at the
@EnableAutoConfiguration
for JPA entities and register them automatically.@EntityScan
can be used to provide Boot with a different root package to scan, but this disables the Boot auto-configuration scanning for entities.When writing a starter that provides entities that should be included, there is currently no transparent way to register them with the persistence provider. Using
@EntityScan
on an auto-configuration class causes the default scan to back off, and@AutoConfigurationPackage
does not register JPA entities (like it registers JPA and other Spring Data repositories).Since JPA entities are part of the "Boot default auto-configure scan", using
@AutoConfigurationPackage
should cause the indicated package to be scanned for entities as well.The text was updated successfully, but these errors were encountered: