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