|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2018 the original author or authors. |
| 2 | + * Copyright 2002-2019 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
107 | 107 | *
|
108 | 108 | * @author Rossen Stoyanchev
|
109 | 109 | * @author Juergen Hoeller
|
| 110 | + * @author Sam Brannen |
110 | 111 | * @since 3.1
|
111 | 112 | * @see HandlerMethodArgumentResolver
|
112 | 113 | * @see HandlerMethodReturnValueHandler
|
@@ -612,16 +613,18 @@ private void initControllerAdviceCache() {
|
612 | 613 | logger.info("Detected @InitBinder methods in " + adviceBean);
|
613 | 614 | }
|
614 | 615 | }
|
615 |
| - if (RequestBodyAdvice.class.isAssignableFrom(beanType)) { |
616 |
| - requestResponseBodyAdviceBeans.add(adviceBean); |
617 |
| - if (logger.isInfoEnabled()) { |
618 |
| - logger.info("Detected RequestBodyAdvice bean in " + adviceBean); |
619 |
| - } |
620 |
| - } |
621 |
| - if (ResponseBodyAdvice.class.isAssignableFrom(beanType)) { |
| 616 | + |
| 617 | + boolean isRequestBodyAdvice = RequestBodyAdvice.class.isAssignableFrom(beanType); |
| 618 | + boolean isResponseBodyAdvice = ResponseBodyAdvice.class.isAssignableFrom(beanType); |
| 619 | + if (isRequestBodyAdvice || isResponseBodyAdvice) { |
622 | 620 | requestResponseBodyAdviceBeans.add(adviceBean);
|
623 | 621 | if (logger.isInfoEnabled()) {
|
624 |
| - logger.info("Detected ResponseBodyAdvice bean in " + adviceBean); |
| 622 | + if (isRequestBodyAdvice) { |
| 623 | + logger.info("Detected RequestBodyAdvice bean in " + adviceBean); |
| 624 | + } |
| 625 | + else { |
| 626 | + logger.info("Detected ResponseBodyAdvice bean in " + adviceBean); |
| 627 | + } |
625 | 628 | }
|
626 | 629 | }
|
627 | 630 | }
|
|
0 commit comments