-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Allow adding packages to entity scanning without disabling the default scanning #30064
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
See also #19024, #27549, and #28232. @odrotbohm, does |
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. |
It does indeed. At least until someone explicitly uses |
Thanks, @odrotbohm. I'm a bit concerned that providing a mechanism that's always additive will surprise users as it's not very Boot-like to have something that can't be switched off or overridden. The documentation (both reference and javadoc) for |
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. |
Apologies for the delayed response. I still wonder whether there's a middle ground here. My primary concern is that you cannot write robust autoconfiguration for a library that wouldn't break apart if the application starts using In my particular case, there's no point in adding the JAR to the project unless you actually include those additional entity types because without them the functionality the JAR would like to provide doesn't work properly. Wouldn't it be okay to provide that way of unconditionally adding the type to the entities to bootstrap but then clearly advise autoconfiguration authors to potentially provide library specific means (e.g. a configuration property) to disable that particular aspect if it? That said, I'd very much appreciate a strong hint in |
In the short term, we're going to improve the documentation of |
We have a very simple use case where this exact feature would be quite handy. Right now, we have a custom health indicator that we share across several services, and one of the functions of our health indicator is to insert records of status into the database (via JPA Entities) - each service has it's own database, but this common table in each database. Right now, we've got the code responsible for this health indicator in a common library, but every consuming service that uses this needs to ensure it also does an We'd like to convert this portion of our library into a proper autoconfigure library, but until the library can self declare/register those entities we can't really do that effectively. |
@Bwvolleyball Assuming that the consuming services do not use |
I would like to provide a library that adds JPA entities to the persistence context bootstrapped. Ideally I would like to achieve that without the user having to explicitly configure
@EntityScan
to include the package of that library solely by registering some auto configuration.I've tried both
@EntityScan
on a configuration class and aBeanDefinitionRegistryPostProcessor
to triggerEntityScanPackages.register(…)
butEntityScanner
will only apply the autoconfiguration package as fallback if no entity package is configured at all.I can see that the semantics of
@EntityScan
are supposed to stay unchanged. I'd be fine with a programmatic approach, so maybe an explicit methodEntityScanPackage.registerAdditional(…)
could populate an additional list thatEntityScanner
adds on top of the defaulted base list?The text was updated successfully, but these errors were encountered: