From f985f71daf905fb20d54a62865458a9ebf4439ad Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 12 May 2017 12:50:17 +0200 Subject: [PATCH] Polishing --- .../xml/BeanDefinitionParserDelegate.java | 20 +++++++------------ .../reactive/AbstractClientHttpRequest.java | 12 +++++------ .../reactive/AbstractServerHttpResponse.java | 17 ++++++++-------- 3 files changed, 21 insertions(+), 28 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java index b13b292d38..6d7b210e62 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java @@ -223,8 +223,6 @@ public class BeanDefinitionParserDelegate { public static final String DEFAULT_AUTOWIRE_ATTRIBUTE = "default-autowire"; - public static final String DEFAULT_DEPENDENCY_CHECK_ATTRIBUTE = "default-dependency-check"; - public static final String DEFAULT_AUTOWIRE_CANDIDATES_ATTRIBUTE = "default-autowire-candidates"; public static final String DEFAULT_INIT_METHOD_ATTRIBUTE = "default-init-method"; @@ -385,7 +383,7 @@ public class BeanDefinitionParserDelegate { public BeanDefinitionDefaults getBeanDefinitionDefaults() { BeanDefinitionDefaults bdd = new BeanDefinitionDefaults(); bdd.setLazyInit("TRUE".equalsIgnoreCase(this.defaults.getLazyInit())); - bdd.setAutowireMode(this.getAutowireMode(DEFAULT_VALUE)); + bdd.setAutowireMode(getAutowireMode(DEFAULT_VALUE)); bdd.setInitMethodName(this.defaults.getInitMethod()); bdd.setDestroyMethodName(this.defaults.getDestroyMethod()); return bdd; @@ -610,22 +608,18 @@ public class BeanDefinitionParserDelegate { bd.setInitMethodName(initMethodName); } } - else { - if (this.defaults.getInitMethod() != null) { - bd.setInitMethodName(this.defaults.getInitMethod()); - bd.setEnforceInitMethod(false); - } + else if (this.defaults.getInitMethod() != null) { + bd.setInitMethodName(this.defaults.getInitMethod()); + bd.setEnforceInitMethod(false); } if (ele.hasAttribute(DESTROY_METHOD_ATTRIBUTE)) { String destroyMethodName = ele.getAttribute(DESTROY_METHOD_ATTRIBUTE); bd.setDestroyMethodName(destroyMethodName); } - else { - if (this.defaults.getDestroyMethod() != null) { - bd.setDestroyMethodName(this.defaults.getDestroyMethod()); - bd.setEnforceDestroyMethod(false); - } + else if (this.defaults.getDestroyMethod() != null) { + bd.setDestroyMethodName(this.defaults.getDestroyMethod()); + bd.setEnforceDestroyMethod(false); } if (ele.hasAttribute(FACTORY_METHOD_ATTRIBUTE)) { diff --git a/spring-web/src/main/java/org/springframework/http/client/reactive/AbstractClientHttpRequest.java b/spring-web/src/main/java/org/springframework/http/client/reactive/AbstractClientHttpRequest.java index 765ad4584d..88d480c6b0 100644 --- a/spring-web/src/main/java/org/springframework/http/client/reactive/AbstractClientHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/client/reactive/AbstractClientHttpRequest.java @@ -108,11 +108,10 @@ public abstract class AbstractClientHttpRequest implements ClientHttpRequest { /** * Apply {@link #beforeCommit(Supplier) beforeCommit} actions, apply the * request headers/cookies, and write the request body. - * @param writeAction the action to write the request body or {@code null} + * @param writeAction the action to write the request body (may be {@code null}) * @return a completion publisher */ protected Mono doCommit(Supplier> writeAction) { - if (!this.state.compareAndSet(State.NEW, State.COMMITTING)) { return Mono.empty(); } @@ -134,15 +133,16 @@ public abstract class AbstractClientHttpRequest implements ClientHttpRequest { return Flux.concat(actions).next(); } + /** - * Implement this method to apply header changes from {@link #getHeaders()} - * to the underlying response. This method is called once only. + * Apply header changes from {@link #getHeaders()} to the underlying response. + * This method is called once only. */ protected abstract void applyHeaders(); /** - * Implement this method to add cookies from {@link #getHeaders()} to the - * underlying response. This method is called once only. + * Add cookies from {@link #getHeaders()} to the underlying response. + * This method is called once only. */ protected abstract void applyCookies(); diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java index 20fa7a0ce9..2d033eac90 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java @@ -183,7 +183,7 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse { /** * Apply {@link #beforeCommit(Supplier) beforeCommit} actions, apply the * response status and headers/cookies, and write the response body. - * @param writeAction the action to write the response body or {@code null} + * @param writeAction the action to write the response body (may be {@code null}) * @return a completion publisher */ protected Mono doCommit(Supplier> writeAction) { @@ -214,33 +214,32 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse { /** - * Implement this method to write to the underlying the response. + * Write to the underlying the response. * @param body the publisher to write with */ protected abstract Mono writeWithInternal(Publisher body); /** - * Implement this method to write to the underlying the response, and flush after - * each {@code Publisher}. + * Write to the underlying the response, and flush after each {@code Publisher}. * @param body the publisher to write and flush with */ protected abstract Mono writeAndFlushWithInternal(Publisher> body); /** - * Implement this method to write the status code to the underlying response. + * Write the status code to the underlying response. * This method is called once only. */ protected abstract void applyStatusCode(); /** - * Implement this method to apply header changes from {@link #getHeaders()} - * to the underlying response. This method is called once only. + * Apply header changes from {@link #getHeaders()} to the underlying response. + * This method is called once only. */ protected abstract void applyHeaders(); /** - * Implement this method to add cookies from {@link #getHeaders()} to the - * underlying response. This method is called once only. + * Add cookies from {@link #getHeaders()} to the underlying response. + * This method is called once only. */ protected abstract void applyCookies();