Skip to content

Commit 41062ba

Browse files
Update documentation
Original Pull Request: #5051
1 parent 1c3da7f commit 41062ba

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MappingMongoConverterUnitTests.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -398,21 +398,12 @@ void writesClassWithBigDecimal() {
398398

399399
assertThat(document.get("value")).isEqualTo(Decimal128.parse("2.5"));
400400
assertThat(((org.bson.Document) document.get("map")).get("foo")).isInstanceOf(Decimal128.class);
401-
} // MappingMongoConverterUnitTests
401+
}
402402

403403
@Test // DATACMNS-42, DATAMONGO-171, GH-4920
404404
void writesClassWithBigDecimalFails() {
405405

406-
MongoCustomConversions conversions = new MongoCustomConversions(new MongoConverterConfigurationAdapter());
407-
408-
mappingContext = new MongoMappingContext();
409-
mappingContext.setApplicationContext(context);
410-
mappingContext.setSimpleTypeHolder(conversions.getSimpleTypeHolder());
411-
mappingContext.afterPropertiesSet();
412-
413-
mappingContext.getPersistentEntity(Address.class);
414-
415-
converter = new MappingMongoConverter(resolver, mappingContext);
406+
converter = createConverter();
416407

417408
BigDecimalContainer container = new BigDecimalContainer();
418409
container.value = BigDecimal.valueOf(2.5d);
@@ -2244,7 +2235,9 @@ void shouldApplyExplicitDecimal128Conversion(BigDecimalRepresentation representa
22442235
assertThat(target.get("bigDecimal")).isEqualTo(new Decimal128(source.bigDecimal));
22452236
}
22462237

2238+
@SuppressWarnings("deprecation")
22472239
static Stream<Arguments> representations() {
2240+
22482241
return Stream.of(Arguments.argumentSet("None (default)", new Object[] { null }), //
22492242
Arguments.argumentSet("STRING", BigDecimalRepresentation.STRING), //
22502243
Arguments.argumentSet("DECIMAL128", BigDecimalRepresentation.DECIMAL128));

src/main/antora/modules/ROOT/pages/migration-guide/migration-guide-4.x-to-5.x.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,4 @@ static class Config extends AbstractMongoClientConfiguration {
5656
}
5757
----
5858

59-
Users upgrading from prior versions may choose `BigDecimalRepresentation.STRING` as default.
60-
Those using`@Field(targetType = FieldType.DECIMAL128)` need to define a combination of representations `configAdapter.bigDecimal(BigDecimalRepresentation.STRING, BigDecimalRepresentation.DECIMAL128)` to set defaulting to String while having the `DECIMAL128` converter being registered for usage with explicit target type configuration.
59+
Users upgrading from prior versions may choose `BigDecimalRepresentation.STRING` as default to retain previous behaviour.

0 commit comments

Comments
 (0)