spring-projects / spring-projects/spring-boot
Allow adding packages to entity scanning without disabling the default scanning
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
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 a BeanDefinitionRegistryPostProcessor to trigger EntityScanPackages.register(…) but EntityScanner 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 method EntityScanPackage.registerAdditional(…) could populate an additional list that EntityScanner adds on top of the defaulted base list?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading EntityScanPackages.register(…) and EntityScanner, focusing on how the autoconfiguration package is used as a fallback when no entity package is configured. The change would need to preserve @EntityScan semantics while allowing additional packages to be registered and included alongside the default base package; no specific test file is mentioned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100