Skip to content

GH-4103 - Use TypeScanner to scan for initial entities. - #5231

Open
masiljangajji wants to merge 3 commits into
spring-projects:mainfrom
masiljangajji:issue/4103-type-scanner
Open

masiljangajji wants to merge 3 commits into
spring-projects:mainfrom
masiljangajji:issue/4103-type-scanner

Conversation

@masiljangajji

@masiljangajji masiljangajji commented Aug 7, 2026 •

Copy link
Copy Markdown
  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

MongoConfigurationSupport.scanForEntities(String) uses a manual ClassPathScanningCandidateComponentProvider loop instead of TypeScanner, which the R2DBC, JDBC and Cassandra modules already use. Class loading failures still fail fast through onClassNotFound(...), now surfacing as IllegalStateException instead of ClassNotFoundException.

Closes #4103

mp911de and others added 3 commits August 5, 2026 16:11
Replace the manual ClassPathScanningCandidateComponentProvider loop in
MongoConfigurationSupport.scanForEntities(String) with the store-agnostic
TypeScanner abstraction that was introduced along with the AOT support,
following AbstractR2dbcConfiguration, JdbcConfiguration and
CassandraEntityClassScanner.

Scanning semantics are retained. Both paths disable default filters and
match through AnnotationTypeFilter considering meta-annotations while
excluding interfaces. Added a characterization test covering directly
annotated types, meta-annotated types and annotated interfaces. It passes
against the previous implementation as well as the new one.

scanForEntities(String) is a protected extension point, so the
throws ClassNotFoundException declaration is retained to keep overriding
code source compatible. Class loading failures keep failing fast by
rethrowing through onClassNotFound(…), as TypeScanner would otherwise
silently drop types that cannot be loaded.

Closes: spring-projects#4103
Signed-off-by: masiljangajji <xmfpdlsj0508@gmail.com>
Signed-off-by: masiljangajji <xmfpdlsj0508@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 7, 2026
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 12, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use TypeScanner to scan for initial entities

4 participants