29
29
30
30
import org .aopalliance .intercept .MethodInterceptor ;
31
31
import org .aopalliance .intercept .MethodInvocation ;
32
+
32
33
import org .springframework .core .ResolvableType ;
33
34
import org .springframework .core .annotation .AnnotationUtils ;
34
35
import org .springframework .data .projection .Accessor ;
45
46
import com .jayway .jsonpath .ParseContext ;
46
47
import com .jayway .jsonpath .PathNotFoundException ;
47
48
import com .jayway .jsonpath .TypeRef ;
48
- import com .jayway .jsonpath .spi .mapper .MappingProvider ;
49
49
import com .jayway .jsonpath .spi .json .JsonProvider ;
50
+ import com .jayway .jsonpath .spi .mapper .MappingProvider ;
50
51
51
52
/**
52
53
* {@link MethodInterceptorFactory} to create a {@link MethodInterceptor} that will
@@ -61,34 +62,38 @@ public class JsonProjectingMethodInterceptorFactory implements MethodInterceptor
61
62
62
63
private final ParseContext context ;
63
64
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
-
84
65
/**
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}.
86
68
*
87
69
* @param mappingProvider must not be {@literal null}.
70
+ * @see Configuration#defaultConfiguration()
71
+ * @see Configuration#jsonProvider()
88
72
*/
89
- @ Deprecated
90
73
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 );
92
97
}
93
98
94
99
/*
0 commit comments