You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently in the process of upgrading several libraries in my project:
org.mongodb:mongodb-driver-legacy:4.6.1 to 4.8.2
org.mongodb:mongodb-driver-sync:4.6.1 to 4.8.2
org.mongodb:mongodb-driver-core:4.6.1 to 4.8.2
org.mongodb:bson:4.6.1 to 4.8.2
org.springframework.data:spring-data-commons:2.7.7 to 3.0.6
org.springframework.data:spring-data-mongodb:3.4.7 to 4.0.6
org.springframework:spring-aop:5.3.27 to 6.0.9
org.springframework:spring-beans:5.3.27 to 6.0.9
org.springframework:spring-context:5.3.27 to 6.0.9
org.springframework:spring-core:5.3.27 to 6.0.9
org.springframework:spring-expression:5.3.27 to 6.0.9
org.springframework:spring-jcl:5.3.27 to 6.0.9
org.springframework:spring-messaging:5.3.27 to 6.0.9
org.springframework:spring-test:5.3.27 to 6.0.9
org.springframework:spring-tx:5.3.27 to 6.0.9
org.springframework:spring-web:5.3.27 to 6.0.9
I've attempted this upgrade with both MongoDB server versions 5.0 and 6.0, as the MongoDB driver release page suggests using MongoDB server version 6.0 for Driver version 4.8. However, I'm still encountering issues.
Scenario
Our use case involves the following scenario:
classField<T> {
privateTvalue;
}
classExample1 {
Field<ClassMapping_T_1> store;
}
// One of the classes we use in Field<T>classClassMapping_T_1 {
Configconfig; // This is an interface
}
// One of the classes we use in Field<T>classClassMapping_T_2 {
Stringselector;
Stringorigin;
}
interfaceConfig {
// Few methods that will be overridden by several other classes
}
classClassImplementing_Config_1implementsConfig {
Stringuid;
Field<List<String>> files; // This is what is causing the exception
}
We have a generics class Field<T>, where T can map to over 100 other classes, and these classes can internally also have Field<T>.
Issue
In the above scenario, we've observed that spring-data-commons is mapping Field<List<String>> to Field<ClassMapping_T_2> and creating a MongoDB BSON Document object that contains Field<ClassMapping_T_2> instead of Field<List<String>>. When this Document reaches the MongoDB driver, it complains that a Codec is not found for Field<ClassMapping_T_2, resulting in a CodecConfigurationException.
Upon further debugging, we noticed that the issue arises in the spring-data-commons library's AbstractMappingContext class. Before the upgrade, the persistentEntities map in AbstractMappingContext had over 2500 entries, whereas after the upgrade, it had roughly 1900 entries.
Before the library upgrade, we observed that AbstractMappingContext had the mapping for Field<List<String>>. After the upgrade, however, it didn't have any mappings for Field<List<String>>, but it did have a mapping for Field<ClassMapping_T_2>. Consequently, spring-data-commons mapped Field<List<String>> to the entity of Field<ClassMapping_T_2>, creating a wrongly wired MongoDB BSON Document object. When this document is given to the MongoDB driver, it complains that there is no Codec found for ClassMapping_T_2, resulting in a CodecConfigurationException.
AbstractMappingContext creates all the mapping contexts through Guice. We tried upgrading org.springframework.guice:spring-guice, which is the bridge from com.google.inject:guice, but had no luck with it.
Request for Assistance
Could any Spring Framework subject matter experts or contributors kindly assist with this issue?
The text was updated successfully, but these errors were encountered:
Issue Description
I'm currently in the process of upgrading several libraries in my project:
I've attempted this upgrade with both MongoDB server versions 5.0 and 6.0, as the MongoDB driver release page suggests using MongoDB server version 6.0 for Driver version 4.8. However, I'm still encountering issues.
Scenario
Our use case involves the following scenario:
We have a generics class
Field<T>
, whereT
can map to over 100 other classes, and these classes can internally also haveField<T>
.Issue
In the above scenario, we've observed that
spring-data-commons
is mappingField<List<String>>
toField<ClassMapping_T_2>
and creating a MongoDB BSON Document object that containsField<ClassMapping_T_2>
instead ofField<List<String>>
. When this Document reaches the MongoDB driver, it complains that a Codec is not found forField<ClassMapping_T_2
, resulting in a CodecConfigurationException.Upon further debugging, we noticed that the issue arises in the
spring-data-commons
library'sAbstractMappingContext
class. Before the upgrade, thepersistentEntities
map inAbstractMappingContext
had over 2500 entries, whereas after the upgrade, it had roughly 1900 entries.Before the library upgrade, we observed that
AbstractMappingContext
had the mapping forField<List<String>>
. After the upgrade, however, it didn't have any mappings forField<List<String>>
, but it did have a mapping forField<ClassMapping_T_2>
. Consequently,spring-data-commons
mappedField<List<String>>
to the entity ofField<ClassMapping_T_2>
, creating a wrongly wired MongoDB BSON Document object. When this document is given to the MongoDB driver, it complains that there is no Codec found forClassMapping_T_2
, resulting in a CodecConfigurationException.AbstractMappingContext
creates all the mapping contexts through Guice. We tried upgradingorg.springframework.guice:spring-guice
, which is the bridge fromcom.google.inject:guice
, but had no luck with it.Request for Assistance
Could any Spring Framework subject matter experts or contributors kindly assist with this issue?
The text was updated successfully, but these errors were encountered: