Accept JsonProvider upon JsonProjectingMethodInterceptorFactory creation.
We now configure explicitly the JsonProvider that is used by JSONPath through JsonProjectingMethodInterceptorFactory to avoid misconfiguration due to JSONPath defaulting attempts. Accepting JsonProvider allows for improved flexibility during configuration. Closes #2403
This commit is contained in:
committed by
Mark Paluch
parent
9ca1c7e157
commit
f91901387f
@@ -17,6 +17,8 @@ package org.springframework.data.web;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import com.jayway.jsonpath.spi.json.JacksonJsonProvider;
|
||||
import com.jayway.jsonpath.spi.json.JsonProvider;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -59,7 +61,8 @@ class JsonProjectingMethodInterceptorFactoryUnitTests {
|
||||
SpelAwareProxyProjectionFactory projectionFactory = new SpelAwareProxyProjectionFactory();
|
||||
|
||||
MappingProvider mappingProvider = new JacksonMappingProvider(new ObjectMapper());
|
||||
projectionFactory.registerMethodInvokerFactory(new JsonProjectingMethodInterceptorFactory(mappingProvider));
|
||||
JsonProvider jsonProvider = new JacksonJsonProvider(new ObjectMapper());
|
||||
projectionFactory.registerMethodInvokerFactory(new JsonProjectingMethodInterceptorFactory(mappingProvider, jsonProvider));
|
||||
|
||||
this.projectionFactory = projectionFactory;
|
||||
this.customer = projectionFactory.createProjection(Customer.class, new ByteArrayInputStream(json.getBytes()));
|
||||
|
||||
Reference in New Issue
Block a user