@@ -141,7 +141,6 @@ public MappingMongoConverter(DbRefResolver dbRefResolver,
141141 this ::getWriteTarget );
142142 this .idMapper = new QueryMapper (this );
143143
144-
145144 this .spELContext = new SpELContext (DocumentPropertyAccessor .INSTANCE );
146145 this .dbRefProxyHandler = new DefaultDbRefProxyHandler (spELContext , mappingContext ,
147146 (prop , bson , evaluator , path ) -> {
@@ -161,8 +160,8 @@ protected ConversionContext getConversionContext(ObjectPath path) {
161160
162161 Assert .notNull (path , "ObjectPath must not be null" );
163162
164- return new ConversionContext (conversions , path , this ::readDocument , this ::readCollectionOrArray , this ::readMap , this :: readDBRef ,
165- this ::getPotentiallyConvertedSimpleRead );
163+ return new ConversionContext (conversions , path , this ::readDocument , this ::readCollectionOrArray , this ::readMap ,
164+ this ::readDBRef , this :: getPotentiallyConvertedSimpleRead );
166165 }
167166
168167 /**
@@ -376,8 +375,7 @@ private <S extends Object> S read(ConversionContext context, MongoPersistentEnti
376375 }
377376
378377 private <S > S populateProperties (ConversionContext context , MongoPersistentEntity <S > entity ,
379- DocumentAccessor documentAccessor ,
380- SpELExpressionEvaluator evaluator , S instance ) {
378+ DocumentAccessor documentAccessor , SpELExpressionEvaluator evaluator , S instance ) {
381379
382380 PersistentPropertyAccessor <S > accessor = new ConvertingPropertyAccessor <>(entity .getPropertyAccessor (instance ),
383381 conversionService );
@@ -423,8 +421,7 @@ private Object readAndPopulateIdentifier(ConversionContext context, PersistentPr
423421
424422 @ Nullable
425423 private Object readIdValue (ConversionContext context , SpELExpressionEvaluator evaluator ,
426- MongoPersistentProperty idProperty ,
427- Object rawId ) {
424+ MongoPersistentProperty idProperty , Object rawId ) {
428425
429426 String expression = idProperty .getSpelExpression ();
430427 Object resolvedValue = expression != null ? evaluator .evaluate (expression ) : rawId ;
@@ -434,8 +431,7 @@ private Object readIdValue(ConversionContext context, SpELExpressionEvaluator ev
434431
435432 private void readProperties (ConversionContext context , MongoPersistentEntity <?> entity ,
436433 PersistentPropertyAccessor <?> accessor , DocumentAccessor documentAccessor ,
437- MongoDbPropertyValueProvider valueProvider ,
438- SpELExpressionEvaluator evaluator ) {
434+ MongoDbPropertyValueProvider valueProvider , SpELExpressionEvaluator evaluator ) {
439435
440436 DbRefResolverCallback callback = null ;
441437
@@ -505,8 +501,7 @@ private void readAssociation(Association<MongoPersistentProperty> association, P
505501
506502 @ Nullable
507503 private Object readUnwrapped (ConversionContext context , DocumentAccessor documentAccessor ,
508- MongoPersistentProperty prop ,
509- MongoPersistentEntity <?> unwrappedEntity ) {
504+ MongoPersistentProperty prop , MongoPersistentEntity <?> unwrappedEntity ) {
510505
511506 if (prop .findAnnotation (Unwrapped .class ).onEmpty ().equals (OnEmpty .USE_EMPTY )) {
512507 return read (context , unwrappedEntity , (Document ) documentAccessor .getDocument ());
@@ -1447,8 +1442,7 @@ private <T> List<T> bulkReadAndConvertDBRefs(ConversionContext context, List<DBR
14471442 T target = null ;
14481443 if (document != null ) {
14491444
1450- maybeEmitEvent (
1451- new AfterLoadEvent <>(document , (Class <T >) type .getType (), collectionName ));
1445+ maybeEmitEvent (new AfterLoadEvent <>(document , (Class <T >) type .getType (), collectionName ));
14521446 target = (T ) readDocument (context , document , type );
14531447 }
14541448
@@ -1541,9 +1535,10 @@ private <T extends Object> T doConvert(Object value, Class<? extends T> target)
15411535 }
15421536
15431537 @ SuppressWarnings ("ConstantConditions" )
1544- private <T extends Object > T doConvert (Object value , Class <? extends T > target , @ Nullable Class <? extends T > fallback ) {
1538+ private <T extends Object > T doConvert (Object value , Class <? extends T > target ,
1539+ @ Nullable Class <? extends T > fallback ) {
15451540
1546- if (conversionService .canConvert (value .getClass (), target ) || fallback == null ) {
1541+ if (conversionService .canConvert (value .getClass (), target ) || fallback == null ) {
15471542 return conversionService .convert (value , target );
15481543 }
15491544 return conversionService .convert (value , fallback );
@@ -1861,9 +1856,10 @@ protected static class ConversionContext {
18611856 private final ContainerValueConverter <DBRef > dbRefConverter ;
18621857 private final ValueConverter <Object > elementConverter ;
18631858
1864- ConversionContext (org .springframework .data .convert .CustomConversions customConversions , ObjectPath path , ContainerValueConverter <Bson > documentConverter ,
1865- ContainerValueConverter <Collection <?>> collectionConverter , ContainerValueConverter <Bson > mapConverter ,
1866- ContainerValueConverter <DBRef > dbRefConverter , ValueConverter <Object > elementConverter ) {
1859+ ConversionContext (org .springframework .data .convert .CustomConversions customConversions , ObjectPath path ,
1860+ ContainerValueConverter <Bson > documentConverter , ContainerValueConverter <Collection <?>> collectionConverter ,
1861+ ContainerValueConverter <Bson > mapConverter , ContainerValueConverter <DBRef > dbRefConverter ,
1862+ ValueConverter <Object > elementConverter ) {
18671863
18681864 this .conversions = customConversions ;
18691865 this .path = path ;
@@ -1935,8 +1931,8 @@ public ConversionContext withPath(ObjectPath currentPath) {
19351931
19361932 Assert .notNull (currentPath , "ObjectPath must not be null" );
19371933
1938- return new ConversionContext (conversions , currentPath , documentConverter , collectionConverter , mapConverter , dbRefConverter ,
1939- elementConverter );
1934+ return new ConversionContext (conversions , currentPath , documentConverter , collectionConverter , mapConverter ,
1935+ dbRefConverter , elementConverter );
19401936 }
19411937
19421938 public ObjectPath getPath () {
0 commit comments