Skip to content
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

Improve documentation to describe how @EntityScan and @Enable…Repositories can be used to tune scanning #36282

Closed
manueljordan opened this issue Jul 8, 2023 · 1 comment
Labels
type: documentation A documentation update
Milestone

Comments

@manueljordan
Copy link

manueljordan commented Jul 8, 2023

In Spring Boot about JPA and Spring Data JPA, exists in the current reference documentation the JPA and Spring Data JPA section, where it has two sub-sections as follows:

These 2 sections have the following content respectively:

By default, all packages below your main configuration class (the one annotated with @EnableAutoConfiguration or @SpringBootApplication) are searched

and

If you use auto-configuration, repositories are searched from the package containing your main configuration class (the one annotated with @EnableAutoConfiguration or @SpringBootApplication) down

For Spring Boot 3.1.1 working with Spring Data JPA the @EntityScan and @EnableJpaRepositories annotations are not necessary to be declared explicitly, only if the packages where the Entities and Repositories are defined, reside within the package containing the main configuration class. I think it should be declared explicitly for each documentation section, according the respective annotation.

Of course, if any of these types (Entities or Repositories) are defined in a package different of the package containing the main configuration class then the respective annotation is mandatory to be declared. Other scenario would be if for @EnableJpaRepositories is need it define some extra configuration, it such as repositoryImplementationPostfix

Therefore an expansion about when to declare or not these annotations to the current Reference Documentation would be valuable.

Thanks for your understanding

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 8, 2023
@wilkinsona
Copy link
Member

We already mention @EntityScan but there's no mention at all of @EnableJpaRepositories. That's inconsistent as @EnableJdbcRepositories is mentioned. We should address that at the least.

@wilkinsona wilkinsona added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 10, 2023
@wilkinsona wilkinsona added this to the 2.7.x milestone Jul 10, 2023
@wilkinsona wilkinsona changed the title Improve documentation to indicate @EntityScan and @EnableJpaRepositories are not explicitly necessary by default Improve documentation to describe how @EntityScan and @Enable…Repositories can be used to tune scanning Aug 9, 2023
@wilkinsona wilkinsona modified the milestones: 2.7.x, 2.7.15 Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

3 participants