2929
3030import org .aopalliance .intercept .MethodInterceptor ;
3131import org .aopalliance .intercept .MethodInvocation ;
32+
3233import org .springframework .core .ResolvableType ;
3334import org .springframework .core .annotation .AnnotationUtils ;
3435import org .springframework .data .projection .Accessor ;
4546import com .jayway .jsonpath .ParseContext ;
4647import com .jayway .jsonpath .PathNotFoundException ;
4748import com .jayway .jsonpath .TypeRef ;
48- import com .jayway .jsonpath .spi .mapper .MappingProvider ;
4949import com .jayway .jsonpath .spi .json .JsonProvider ;
50+ import com .jayway .jsonpath .spi .mapper .MappingProvider ;
5051
5152/**
5253 * {@link MethodInterceptorFactory} to create a {@link MethodInterceptor} that will
@@ -61,34 +62,38 @@ public class JsonProjectingMethodInterceptorFactory implements MethodInterceptor
6162
6263 private final ParseContext context ;
6364
64- /**
65- * Creates a new {@link JsonProjectingMethodInterceptorFactory} using the given {@link MappingProvider} and {@link JsonProvider}.
66- *
67- * @param mappingProvider must not be {@literal null}.
68- * @param jsonProvider must not be {@literal null}.
69- */
70- public JsonProjectingMethodInterceptorFactory (MappingProvider mappingProvider , JsonProvider jsonProvider ) {
71-
72- Assert .notNull (mappingProvider , "MappingProvider must not be null!" );
73- Assert .notNull (jsonProvider , "JsonProvider must not be null!" );
74-
75- Configuration configuration = Configuration .builder ()//
76- .options (Option .ALWAYS_RETURN_LIST )//
77- .mappingProvider (mappingProvider )//
78- .jsonProvider (jsonProvider )//
79- .build ();
80-
81- this .context = JsonPath .using (configuration );
82- }
83-
8465 /**
85- * Creates a new {@link JsonProjectingMethodInterceptorFactory} using the given {@link MappingProvider}.
66+ * Creates a new {@link JsonProjectingMethodInterceptorFactory} using the default {@link JsonProvider} and the given
67+ * {@link MappingProvider}.
8668 *
8769 * @param mappingProvider must not be {@literal null}.
70+ * @see Configuration#defaultConfiguration()
71+ * @see Configuration#jsonProvider()
8872 */
89- @ Deprecated
9073 public JsonProjectingMethodInterceptorFactory (MappingProvider mappingProvider ) {
91- this (mappingProvider , Configuration .defaultConfiguration ().jsonProvider ());
74+ this (Configuration .defaultConfiguration ().jsonProvider (), mappingProvider );
75+ }
76+
77+ /**
78+ * Creates a new {@link JsonProjectingMethodInterceptorFactory} using the given {@link JsonProvider} and
79+ * {@link MappingProvider}.
80+ *
81+ * @param jsonProvider must not be {@literal null}.
82+ * @param mappingProvider must not be {@literal null}.
83+ * @since 2.5.3
84+ */
85+ public JsonProjectingMethodInterceptorFactory (JsonProvider jsonProvider , MappingProvider mappingProvider ) {
86+
87+ Assert .notNull (jsonProvider , "JsonProvider must not be null!" );
88+ Assert .notNull (mappingProvider , "MappingProvider must not be null!" );
89+
90+ Configuration configuration = Configuration .builder ()//
91+ .options (Option .ALWAYS_RETURN_LIST ) //
92+ .jsonProvider (jsonProvider ) //
93+ .mappingProvider (mappingProvider ) //
94+ .build ();
95+
96+ this .context = JsonPath .using (configuration );
9297 }
9398
9499 /*
0 commit comments