@@ -83,34 +83,32 @@ public abstract class AbstractMethodMessageHandler<T>
83
83
84
84
protected final Log logger = LogFactory .getLog (getClass ());
85
85
86
- private final List <HandlerMethodArgumentResolver > customArgumentResolvers = new ArrayList <HandlerMethodArgumentResolver >(4 );
86
+ private Collection <String > destinationPrefixes = new ArrayList <String >();
87
+
88
+ private final List <HandlerMethodArgumentResolver > customArgumentResolvers =
89
+ new ArrayList <HandlerMethodArgumentResolver >(4 );
90
+
91
+ private final List <HandlerMethodReturnValueHandler > customReturnValueHandlers =
92
+ new ArrayList <HandlerMethodReturnValueHandler >(4 );
87
93
88
- private final List <HandlerMethodReturnValueHandler > customReturnValueHandlers = new ArrayList <HandlerMethodReturnValueHandler >(4 );
94
+ private final HandlerMethodArgumentResolverComposite argumentResolvers =
95
+ new HandlerMethodArgumentResolverComposite ();
89
96
90
- private final HandlerMethodArgumentResolverComposite argumentResolvers = new HandlerMethodArgumentResolverComposite ();
97
+ private final HandlerMethodReturnValueHandlerComposite returnValueHandlers =
98
+ new HandlerMethodReturnValueHandlerComposite ();
91
99
92
- private final HandlerMethodReturnValueHandlerComposite returnValueHandlers = new HandlerMethodReturnValueHandlerComposite () ;
100
+ private ApplicationContext applicationContext ;
93
101
94
- private final Map <T , HandlerMethod > handlerMethods = new LinkedHashMap <T , HandlerMethod >();
102
+ private final Map <T , HandlerMethod > handlerMethods = new LinkedHashMap <T , HandlerMethod >(64 );
95
103
96
- private final MultiValueMap <String , T > destinationLookup = new LinkedMultiValueMap <String , T >();
104
+ private final MultiValueMap <String , T > destinationLookup = new LinkedMultiValueMap <String , T >(64 );
97
105
98
106
private final Map <Class <?>, AbstractExceptionHandlerMethodResolver > exceptionHandlerCache =
99
107
new ConcurrentHashMap <Class <?>, AbstractExceptionHandlerMethodResolver >(64 );
100
108
101
109
private final Map <MessagingAdviceBean , AbstractExceptionHandlerMethodResolver > exceptionHandlerAdviceCache =
102
110
new LinkedHashMap <MessagingAdviceBean , AbstractExceptionHandlerMethodResolver >(64 );
103
111
104
- private Collection <String > destinationPrefixes = new ArrayList <String >();
105
-
106
- private ApplicationContext applicationContext ;
107
-
108
- /**
109
- * Return the configured destination prefixes.
110
- */
111
- public Collection <String > getDestinationPrefixes () {
112
- return this .destinationPrefixes ;
113
- }
114
112
115
113
/**
116
114
* When this property is configured only messages to destinations matching
@@ -131,16 +129,15 @@ public void setDestinationPrefixes(Collection<String> prefixes) {
131
129
}
132
130
133
131
/**
134
- * Return the configured custom argument resolvers , if any.
132
+ * Return the configured destination prefixes , if any.
135
133
*/
136
- public List < HandlerMethodArgumentResolver > getCustomArgumentResolvers () {
137
- return this .customArgumentResolvers ;
134
+ public Collection < String > getDestinationPrefixes () {
135
+ return this .destinationPrefixes ;
138
136
}
139
137
140
138
/**
141
139
* Sets the list of custom {@code HandlerMethodArgumentResolver}s that will be used
142
140
* after resolvers for supported argument type.
143
- * @param customArgumentResolvers the list of resolvers; never {@code null}.
144
141
*/
145
142
public void setCustomArgumentResolvers (List <HandlerMethodArgumentResolver > customArgumentResolvers ) {
146
143
this .customArgumentResolvers .clear ();
@@ -150,16 +147,15 @@ public void setCustomArgumentResolvers(List<HandlerMethodArgumentResolver> custo
150
147
}
151
148
152
149
/**
153
- * Return the configured custom return value handlers , if any.
150
+ * Return the configured custom argument resolvers , if any.
154
151
*/
155
- public List <HandlerMethodReturnValueHandler > getCustomReturnValueHandlers () {
156
- return this .customReturnValueHandlers ;
152
+ public List <HandlerMethodArgumentResolver > getCustomArgumentResolvers () {
153
+ return this .customArgumentResolvers ;
157
154
}
158
155
159
156
/**
160
157
* Set the list of custom {@code HandlerMethodReturnValueHandler}s that will be used
161
158
* after return value handlers for known types.
162
- * @param customReturnValueHandlers the list of custom return value handlers, never {@code null}.
163
159
*/
164
160
public void setCustomReturnValueHandlers (List <HandlerMethodReturnValueHandler > customReturnValueHandlers ) {
165
161
this .customReturnValueHandlers .clear ();
@@ -169,15 +165,15 @@ public void setCustomReturnValueHandlers(List<HandlerMethodReturnValueHandler> c
169
165
}
170
166
171
167
/**
172
- * Return the configured argument resolvers , if any.
168
+ * Return the configured custom return value handlers , if any.
173
169
*/
174
- public List <HandlerMethodArgumentResolver > getArgumentResolvers () {
175
- return this .argumentResolvers . getResolvers () ;
170
+ public List <HandlerMethodReturnValueHandler > getCustomReturnValueHandlers () {
171
+ return this .customReturnValueHandlers ;
176
172
}
177
173
178
174
/**
179
- * Configure the complete list of supported argument types effectively overriding
180
- * the ones configured by default. This is an advanced option. For most use cases
175
+ * Configure the complete list of supported argument types, effectively overriding
176
+ * the ones configured by default. This is an advanced option; for most use cases
181
177
* it should be sufficient to use {@link #setCustomArgumentResolvers}.
182
178
*/
183
179
public void setArgumentResolvers (List <HandlerMethodArgumentResolver > argumentResolvers ) {
@@ -189,15 +185,15 @@ public void setArgumentResolvers(List<HandlerMethodArgumentResolver> argumentRes
189
185
}
190
186
191
187
/**
192
- * Return the configured return value handlers, if any .
188
+ * Return the complete list of argument resolvers .
193
189
*/
194
- public List <HandlerMethodReturnValueHandler > getReturnValueHandlers () {
195
- return this .returnValueHandlers . getReturnValueHandlers ();
190
+ public List <HandlerMethodArgumentResolver > getArgumentResolvers () {
191
+ return this .argumentResolvers . getResolvers ();
196
192
}
197
193
198
194
/**
199
- * Configure the complete list of supported return value types effectively overriding
200
- * the ones configured by default. This is an advanced option. For most use cases
195
+ * Configure the complete list of supported return value types, effectively overriding
196
+ * the ones configured by default. This is an advanced option; for most use cases
201
197
* it should be sufficient to use {@link #setCustomReturnValueHandlers}.
202
198
*/
203
199
public void setReturnValueHandlers (List <HandlerMethodReturnValueHandler > returnValueHandlers ) {
@@ -208,15 +204,23 @@ public void setReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnV
208
204
this .returnValueHandlers .addHandlers (returnValueHandlers );
209
205
}
210
206
211
- public ApplicationContext getApplicationContext () {
212
- return this .applicationContext ;
207
+ /**
208
+ * Return the complete list of return value handlers.
209
+ */
210
+ public List <HandlerMethodReturnValueHandler > getReturnValueHandlers () {
211
+ return this .returnValueHandlers .getReturnValueHandlers ();
213
212
}
214
213
215
214
@ Override
216
215
public void setApplicationContext (ApplicationContext applicationContext ) {
217
216
this .applicationContext = applicationContext ;
218
217
}
219
218
219
+ public ApplicationContext getApplicationContext () {
220
+ return this .applicationContext ;
221
+ }
222
+
223
+
220
224
@ Override
221
225
public void afterPropertiesSet () {
222
226
if (this .argumentResolvers .getResolvers ().isEmpty ()) {
@@ -359,7 +363,9 @@ protected HandlerMethod createHandlerMethod(Object handler, Method method) {
359
363
* (e.g. to support "global" {@code @MessageExceptionHandler}).
360
364
* @since 4.2
361
365
*/
362
- protected void registerExceptionHandlerAdvice (MessagingAdviceBean bean , AbstractExceptionHandlerMethodResolver resolver ) {
366
+ protected void registerExceptionHandlerAdvice (
367
+ MessagingAdviceBean bean , AbstractExceptionHandlerMethodResolver resolver ) {
368
+
363
369
this .exceptionHandlerAdviceCache .put (bean , resolver );
364
370
}
365
371
0 commit comments