spring-projects / spring-projects/spring-data-mongodb
MappingMongoContext.shouldCreatePersistentEntityFor() does not consider simple types [DATAMONGO-1826]
@mp911de is already working on this.
Since Dec 30, 2020.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Mark Paluch opened DATAMONGO-1826 and commented
MappingMongoContext creates persistent entities for types which are considered to be simple ones. The actual issue occurs on encapsulated runtimes such as Java 9 where we attempt to introspect types with deep reflection. The memory consumed by superfluous entities is a less considerable aspect.
The effect of creating superfluous entities is not entirely a harm. It's also a feature which allows usage of the mapping context for types that have a custom converter registered. Preventing persistent entity creation would break existing functionality coming out of entity metadata (such as query mapping, determining a collection name).
We should investigate whether we can preserve that functionality to some degree while excluding unwanted typed from the mapping context. One approach could be opt-in using the @Document annotation or via the initial entity set
Affects: 2.0.1 (Kay SR1)
Issue Links:
- DATAMONGO-1819 Discovering the preferred constructor lead to InaccessibleObjectException with Java 9
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.
Assessment
This issue has not been assessed yet.