Use FormattingConversionService in JSON Patch binding.

We no pipe the Spring MVC ConversionService into the JSON Patch path binding. That usually is a FormattingConversionService at runtime and also supports the conversion of dates.

The ConversionServices is configured into the BindContext(Factory) we use for binding. The context then exposes the EvaluationContext set up with it.

Fixes #2233.
This commit is contained in:
Oliver Drotbohm
2023-02-21 18:40:31 +01:00
parent fdb9c660ee
commit a71ffd65c7
9 changed files with 80 additions and 17 deletions

View File

@@ -30,6 +30,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.mongodb.core.convert.MongoCustomConversions;
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
@@ -76,7 +77,8 @@ class JsonPatchHandlerUnitTests {
PersistentEntities entities = new PersistentEntities(Arrays.asList(context));
Associations associations = new Associations(mappings, mock(RepositoryRestConfiguration.class));
BindContextFactory factory = new PersistentEntitiesBindContextFactory(entities);
BindContextFactory factory = new PersistentEntitiesBindContextFactory(entities,
DefaultConversionService.getSharedInstance());
this.handler = new JsonPatchHandler(factory, new DomainObjectReader(entities, associations));