Browse Source

Polishing

pull/22633/head
Juergen Hoeller 7 years ago
parent
commit
18ce8564e2
  1. 8
      spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java
  2. 4
      spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java
  3. 25
      spring-context/src/main/java/org/springframework/context/annotation/DeferredImportSelector.java
  4. 5
      spring-context/src/main/java/org/springframework/context/annotation/ImportBeanDefinitionRegistrar.java
  5. 16
      spring-context/src/main/java/org/springframework/context/annotation/ImportSelector.java
  6. 12
      spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
  7. 42
      spring-core/src/main/java/org/springframework/util/ObjectUtils.java
  8. 7
      spring-jms/src/main/java/org/springframework/jms/config/MethodJmsListenerEndpoint.java
  9. 6
      spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MethodArgumentNotValidException.java
  10. 18
      spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java
  11. 4
      spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java
  12. 4
      spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.java
  13. 10
      spring-test/src/main/java/org/springframework/test/context/TestContext.java
  14. 5
      spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultMockServerSpec.java
  15. 5
      spring-test/src/main/java/org/springframework/test/web/reactive/server/MockServerConfigurer.java
  16. 3
      spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClientConfigurer.java
  17. 4
      spring-web/src/main/java/org/springframework/http/server/reactive/ChannelSendOperator.java
  18. 52
      spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/AbstractRequestCondition.java
  19. 6
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java

8
spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -161,8 +161,7 @@ public abstract class YamlProcessor {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Loading from YAML: " + resource); logger.debug("Loading from YAML: " + resource);
} }
Reader reader = new UnicodeReader(resource.getInputStream()); try (Reader reader = new UnicodeReader(resource.getInputStream())) {
try {
for (Object object : yaml.loadAll(reader)) { for (Object object : yaml.loadAll(reader)) {
if (object != null && process(asMap(object), callback)) { if (object != null && process(asMap(object), callback)) {
count++; count++;
@ -176,9 +175,6 @@ public abstract class YamlProcessor {
" from YAML resource: " + resource); " from YAML resource: " + resource);
} }
} }
finally {
reader.close();
}
} }
catch (IOException ex) { catch (IOException ex) {
handleProcessError(resource, ex); handleProcessError(resource, ex);

4
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -663,7 +663,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
* Return whether this bean has the specified qualifier. * Return whether this bean has the specified qualifier.
*/ */
public boolean hasQualifier(String typeName) { public boolean hasQualifier(String typeName) {
return this.qualifiers.keySet().contains(typeName); return this.qualifiers.containsKey(typeName);
} }
/** /**

25
spring-context/src/main/java/org/springframework/context/annotation/DeferredImportSelector.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -40,8 +40,10 @@ import org.springframework.lang.Nullable;
public interface DeferredImportSelector extends ImportSelector { public interface DeferredImportSelector extends ImportSelector {
/** /**
* Return a specific import group or {@code null} if no grouping is required. * Return a specific import group.
* @return the import group class or {@code null} * <p>The default implementations return {@code null} for no grouping required.
* @return the import group class, or {@code null} if none
* @since 5.0
*/ */
@Nullable @Nullable
default Class<? extends Group> getImportGroup() { default Class<? extends Group> getImportGroup() {
@ -61,11 +63,12 @@ public interface DeferredImportSelector extends ImportSelector {
void process(AnnotationMetadata metadata, DeferredImportSelector selector); void process(AnnotationMetadata metadata, DeferredImportSelector selector);
/** /**
* Return the {@link Entry entries} of which class(es) should be imported for this * Return the {@link Entry entries} of which class(es) should be imported
* group. * for this group.
*/ */
Iterable<Entry> selectImports(); Iterable<Entry> selectImports();
/** /**
* An entry that holds the {@link AnnotationMetadata} of the importing * An entry that holds the {@link AnnotationMetadata} of the importing
* {@link Configuration} class and the class name to import. * {@link Configuration} class and the class name to import.
@ -97,16 +100,16 @@ public interface DeferredImportSelector extends ImportSelector {
} }
@Override @Override
public boolean equals(Object o) { public boolean equals(Object other) {
if (this == o) { if (this == other) {
return true; return true;
} }
if (o == null || getClass() != o.getClass()) { if (other == null || getClass() != other.getClass()) {
return false; return false;
} }
Entry entry = (Entry) o; Entry entry = (Entry) other;
return Objects.equals(this.metadata, entry.metadata) && return (Objects.equals(this.metadata, entry.metadata) &&
Objects.equals(this.importClassName, entry.importClassName); Objects.equals(this.importClassName, entry.importClassName));
} }
@Override @Override

5
spring-context/src/main/java/org/springframework/context/annotation/ImportBeanDefinitionRegistrar.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -58,7 +58,6 @@ public interface ImportBeanDefinitionRegistrar {
* @param importingClassMetadata annotation metadata of the importing class * @param importingClassMetadata annotation metadata of the importing class
* @param registry current bean definition registry * @param registry current bean definition registry
*/ */
public void registerBeanDefinitions( void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry);
AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry);
} }

16
spring-context/src/main/java/org/springframework/context/annotation/ImportSelector.java

@ -20,12 +20,12 @@ import org.springframework.core.type.AnnotationMetadata;
/** /**
* Interface to be implemented by types that determine which @{@link Configuration} * Interface to be implemented by types that determine which @{@link Configuration}
* class(es) should be imported based on a given selection criteria, usually one or more * class(es) should be imported based on a given selection criteria, usually one or
* annotation attributes. * more annotation attributes.
* *
* <p>An {@link ImportSelector} may implement any of the following * <p>An {@link ImportSelector} may implement any of the following
* {@link org.springframework.beans.factory.Aware Aware} interfaces, and their respective * {@link org.springframework.beans.factory.Aware Aware} interfaces,
* methods will be called prior to {@link #selectImports}: * and their respective methods will be called prior to {@link #selectImports}:
* <ul> * <ul>
* <li>{@link org.springframework.context.EnvironmentAware EnvironmentAware}</li> * <li>{@link org.springframework.context.EnvironmentAware EnvironmentAware}</li>
* <li>{@link org.springframework.beans.factory.BeanFactoryAware BeanFactoryAware}</li> * <li>{@link org.springframework.beans.factory.BeanFactoryAware BeanFactoryAware}</li>
@ -33,10 +33,10 @@ import org.springframework.core.type.AnnotationMetadata;
* <li>{@link org.springframework.context.ResourceLoaderAware ResourceLoaderAware}</li> * <li>{@link org.springframework.context.ResourceLoaderAware ResourceLoaderAware}</li>
* </ul> * </ul>
* *
* <p>ImportSelectors are usually processed in the same way as regular {@code @Import} * <p>{@code ImportSelector} implementations are usually processed in the same way
* annotations, however, it is also possible to defer selection of imports until all * as regular {@code @Import} annotations, however, it is also possible to defer
* {@code @Configuration} classes have been processed (see {@link DeferredImportSelector} * selection of imports until all {@code @Configuration} classes have been processed
* for details). * (see {@link DeferredImportSelector} for details).
* *
* @author Chris Beams * @author Chris Beams
* @since 3.1 * @since 3.1

12
spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java

@ -91,24 +91,24 @@ import org.springframework.util.ReflectionUtils;
* to detect special beans defined in its internal bean factory: * to detect special beans defined in its internal bean factory:
* Therefore, this class automatically registers * Therefore, this class automatically registers
* {@link org.springframework.beans.factory.config.BeanFactoryPostProcessor BeanFactoryPostProcessors}, * {@link org.springframework.beans.factory.config.BeanFactoryPostProcessor BeanFactoryPostProcessors},
* {@link org.springframework.beans.factory.config.BeanPostProcessor BeanPostProcessors} * {@link org.springframework.beans.factory.config.BeanPostProcessor BeanPostProcessors},
* and {@link org.springframework.context.ApplicationListener ApplicationListeners} * and {@link org.springframework.context.ApplicationListener ApplicationListeners}
* which are defined as beans in the context. * which are defined as beans in the context.
* *
* <p>A {@link org.springframework.context.MessageSource} may also be supplied * <p>A {@link org.springframework.context.MessageSource} may also be supplied
* as a bean in the context, with the name "messageSource"; otherwise, message * as a bean in the context, with the name "messageSource"; otherwise, message
* resolution is delegated to the parent context. Furthermore, a multicaster * resolution is delegated to the parent context. Furthermore, a multicaster
* for application events can be supplied as "applicationEventMulticaster" bean * for application events can be supplied as an "applicationEventMulticaster" bean
* of type {@link org.springframework.context.event.ApplicationEventMulticaster} * of type {@link org.springframework.context.event.ApplicationEventMulticaster}
* in the context; otherwise, a default multicaster of type * in the context; otherwise, a default multicaster of type
* {@link org.springframework.context.event.SimpleApplicationEventMulticaster} will be used. * {@link org.springframework.context.event.SimpleApplicationEventMulticaster} will be used.
* *
* <p>Implements resource loading through extending * <p>Implements resource loading by extending
* {@link org.springframework.core.io.DefaultResourceLoader}. * {@link org.springframework.core.io.DefaultResourceLoader}.
* Consequently treats non-URL resource paths as class path resources * Consequently treats non-URL resource paths as class path resources
* (supporting full class path resource names that include the package path, * (supporting full class path resource names that include the package path,
* e.g. "mypackage/myresource.dat"), unless the {@link #getResourceByPath} * e.g. "mypackage/myresource.dat"), unless the {@link #getResourceByPath}
* method is overwritten in a subclass. * method is overridden in a subclass.
* *
* @author Rod Johnson * @author Rod Johnson
* @author Juergen Hoeller * @author Juergen Hoeller
@ -392,7 +392,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
else { else {
applicationEvent = new PayloadApplicationEvent<>(this, event); applicationEvent = new PayloadApplicationEvent<>(this, event);
if (eventType == null) { if (eventType == null) {
eventType = ((PayloadApplicationEvent) applicationEvent).getResolvableType(); eventType = ((PayloadApplicationEvent<?>) applicationEvent).getResolvableType();
} }
} }
@ -714,7 +714,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
} }
/** /**
* Instantiate and invoke all registered BeanPostProcessor beans, * Instantiate and register all BeanPostProcessor beans,
* respecting explicit order if given. * respecting explicit order if given.
* <p>Must be called before any instantiation of application beans. * <p>Must be called before any instantiation of application beans.
*/ */

42
spring-core/src/main/java/org/springframework/util/ObjectUtils.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -639,7 +639,7 @@ public abstract class ObjectUtils {
/** /**
* Determine the class name for the given object. * Determine the class name for the given object.
* <p>Returns {@code "null"} if {@code obj} is {@code null}. * <p>Returns a {@code "null"} String if {@code obj} is {@code null}.
* @param obj the object to introspect (may be {@code null}) * @param obj the object to introspect (may be {@code null})
* @return the corresponding class name * @return the corresponding class name
*/ */
@ -650,7 +650,7 @@ public abstract class ObjectUtils {
/** /**
* Return a String representation of the specified Object. * Return a String representation of the specified Object.
* <p>Builds a String representation of the contents in case of an array. * <p>Builds a String representation of the contents in case of an array.
* Returns {@code "null"} if {@code obj} is {@code null}. * Returns a {@code "null"} String if {@code obj} is {@code null}.
* @param obj the object to build a String representation for * @param obj the object to build a String representation for
* @return a String representation of {@code obj} * @return a String representation of {@code obj}
*/ */
@ -696,8 +696,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array. * Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements, * <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns * by the characters {@code ", "} (a comma followed by a space).
* {@code "null"} if {@code array} is {@code null}. * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for * @param array the array to build a String representation for
* @return a String representation of {@code array} * @return a String representation of {@code array}
*/ */
@ -727,8 +727,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array. * Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements, * <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns * by the characters {@code ", "} (a comma followed by a space).
* {@code "null"} if {@code array} is {@code null}. * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for * @param array the array to build a String representation for
* @return a String representation of {@code array} * @return a String representation of {@code array}
*/ */
@ -759,8 +759,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array. * Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements, * <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns * by the characters {@code ", "} (a comma followed by a space).
* {@code "null"} if {@code array} is {@code null}. * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for * @param array the array to build a String representation for
* @return a String representation of {@code array} * @return a String representation of {@code array}
*/ */
@ -790,8 +790,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array. * Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements, * <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns * by the characters {@code ", "} (a comma followed by a space).
* {@code "null"} if {@code array} is {@code null}. * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for * @param array the array to build a String representation for
* @return a String representation of {@code array} * @return a String representation of {@code array}
*/ */
@ -821,8 +821,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array. * Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements, * <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns * by the characters {@code ", "} (a comma followed by a space).
* {@code "null"} if {@code array} is {@code null}. * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for * @param array the array to build a String representation for
* @return a String representation of {@code array} * @return a String representation of {@code array}
*/ */
@ -853,8 +853,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array. * Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements, * <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns * by the characters {@code ", "} (a comma followed by a space).
* {@code "null"} if {@code array} is {@code null}. * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for * @param array the array to build a String representation for
* @return a String representation of {@code array} * @return a String representation of {@code array}
*/ */
@ -885,8 +885,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array. * Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements, * <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns * by the characters {@code ", "} (a comma followed by a space).
* {@code "null"} if {@code array} is {@code null}. * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for * @param array the array to build a String representation for
* @return a String representation of {@code array} * @return a String representation of {@code array}
*/ */
@ -916,8 +916,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array. * Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements, * <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns * by the characters {@code ", "} (a comma followed by a space).
* {@code "null"} if {@code array} is {@code null}. * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for * @param array the array to build a String representation for
* @return a String representation of {@code array} * @return a String representation of {@code array}
*/ */
@ -947,8 +947,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array. * Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements, * <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns * by the characters {@code ", "} (a comma followed by a space).
* {@code "null"} if {@code array} is {@code null}. * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for * @param array the array to build a String representation for
* @return a String representation of {@code array} * @return a String representation of {@code array}
*/ */

7
spring-jms/src/main/java/org/springframework/jms/config/MethodJmsListenerEndpoint.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -147,8 +147,11 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
Assert.state(this.messageHandlerMethodFactory != null, Assert.state(this.messageHandlerMethodFactory != null,
"Could not create message listener - MessageHandlerMethodFactory not set"); "Could not create message listener - MessageHandlerMethodFactory not set");
MessagingMessageListenerAdapter messageListener = createMessageListenerInstance(); MessagingMessageListenerAdapter messageListener = createMessageListenerInstance();
Object bean = getBean();
Method method = getMethod();
Assert.state(bean != null && method != null, "No bean+method set on endpoint");
InvocableHandlerMethod invocableHandlerMethod = InvocableHandlerMethod invocableHandlerMethod =
this.messageHandlerMethodFactory.createInvocableHandlerMethod(getBean(), getMethod()); this.messageHandlerMethodFactory.createInvocableHandlerMethod(bean, method);
messageListener.setHandlerMethod(invocableHandlerMethod); messageListener.setHandlerMethod(invocableHandlerMethod);
String responseDestination = getDefaultResponseDestination(); String responseDestination = getDefaultResponseDestination();
if (StringUtils.hasText(responseDestination)) { if (StringUtils.hasText(responseDestination)) {

6
spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MethodArgumentNotValidException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -34,7 +34,8 @@ import org.springframework.validation.ObjectError;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class MethodArgumentNotValidException extends MethodArgumentResolutionException { public class MethodArgumentNotValidException extends MethodArgumentResolutionException {
private BindingResult bindingResult; @Nullable
private final BindingResult bindingResult;
/** /**
@ -42,6 +43,7 @@ public class MethodArgumentNotValidException extends MethodArgumentResolutionExc
*/ */
public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter) { public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter) {
super(message, parameter); super(message, parameter);
this.bindingResult = null;
} }
/** /**

18
spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -66,18 +66,20 @@ import org.springframework.validation.Validator;
* protocols such as STOMP. * protocols such as STOMP.
* *
* <p>{@link #clientInboundChannel()} and {@link #clientOutboundChannel()} deliver * <p>{@link #clientInboundChannel()} and {@link #clientOutboundChannel()} deliver
* messages to and from remote clients to several message handlers such as * messages to and from remote clients to several message handlers such as the
* following.
* <ul> * <ul>
* <li>{@link #simpAnnotationMethodMessageHandler()}</li> * <li>{@link #simpAnnotationMethodMessageHandler()}</li>
* <li>{@link #simpleBrokerMessageHandler()}</li> * <li>{@link #simpleBrokerMessageHandler()}</li>
* <li>{@link #stompBrokerRelayMessageHandler()}</li> * <li>{@link #stompBrokerRelayMessageHandler()}</li>
* <li>{@link #userDestinationMessageHandler()}</li> * <li>{@link #userDestinationMessageHandler()}</li>
* </ul> * </ul>
* while {@link #brokerChannel()} delivers messages from within the application to the *
* <p>{@link #brokerChannel()} delivers messages from within the application to the
* the respective message handlers. {@link #brokerMessagingTemplate()} can be injected * the respective message handlers. {@link #brokerMessagingTemplate()} can be injected
* into any application component to send messages. * into any application component to send messages.
* *
* <p>Subclasses are responsible for the part of the configuration that feed messages * <p>Subclasses are responsible for the parts of the configuration that feed messages
* to and from the client inbound/outbound channels (e.g. STOMP over WebSocket). * to and from the client inbound/outbound channels (e.g. STOMP over WebSocket).
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
@ -396,7 +398,7 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
* Override this method to add custom message converters. * Override this method to add custom message converters.
* @param messageConverters the list to add converters to, initially empty * @param messageConverters the list to add converters to, initially empty
* @return {@code true} if default message converters should be added to list, * @return {@code true} if default message converters should be added to list,
* {@code false} if no more converters should be added. * {@code false} if no more converters should be added
*/ */
protected boolean configureMessageConverters(List<MessageConverter> messageConverters) { protected boolean configureMessageConverters(List<MessageConverter> messageConverters) {
return true; return true;
@ -419,13 +421,13 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
} }
/** /**
* Create the user registry that provides access to the local users. * Create the user registry that provides access to local users.
*/ */
protected abstract SimpUserRegistry createLocalUserRegistry(); protected abstract SimpUserRegistry createLocalUserRegistry();
/** /**
* Return a {@link org.springframework.validation.Validator}s instance for validating * Return an {@link org.springframework.validation.Validator} instance for
* {@code @Payload} method arguments. * validating {@code @Payload} method arguments.
* <p>In order, this method tries to get a Validator instance: * <p>In order, this method tries to get a Validator instance:
* <ul> * <ul>
* <li>delegating to getValidator() first</li> * <li>delegating to getValidator() first</li>

4
spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -267,7 +267,7 @@ public class StompDecoder {
if (index + 1 >= inString.length()) { if (index + 1 >= inString.length()) {
throw new StompConversionException("Illegal escape sequence at index " + index + ": " + inString); throw new StompConversionException("Illegal escape sequence at index " + index + ": " + inString);
} }
Character c = inString.charAt(index + 1); char c = inString.charAt(index + 1);
if (c == 'r') { if (c == 'r') {
sb.append('\r'); sb.append('\r');
} }

4
spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -64,7 +64,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
* Create an instance wrapping the local user registry. * Create an instance wrapping the local user registry.
*/ */
public MultiServerUserRegistry(SimpUserRegistry localRegistry) { public MultiServerUserRegistry(SimpUserRegistry localRegistry) {
Assert.notNull(localRegistry, "'localRegistry' is required."); Assert.notNull(localRegistry, "'localRegistry' is required");
this.id = generateId(); this.id = generateId();
this.localRegistry = localRegistry; this.localRegistry = localRegistry;
this.delegateApplicationEvents = this.localRegistry instanceof SmartApplicationListener; this.delegateApplicationEvents = this.localRegistry instanceof SmartApplicationListener;

10
spring-test/src/main/java/org/springframework/test/context/TestContext.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -38,6 +38,8 @@ import org.springframework.test.annotation.DirtiesContext.HierarchyMode;
* *
* @author Sam Brannen * @author Sam Brannen
* @since 2.5 * @since 2.5
* @see TestContextManager
* @see TestExecutionListener
*/ */
public interface TestContext extends AttributeAccessor, Serializable { public interface TestContext extends AttributeAccessor, Serializable {
@ -47,7 +49,7 @@ public interface TestContext extends AttributeAccessor, Serializable {
* <p>Implementations of this method are responsible for loading the * <p>Implementations of this method are responsible for loading the
* application context if the corresponding context has not already been * application context if the corresponding context has not already been
* loaded, potentially caching the context as well. * loaded, potentially caching the context as well.
* @return the application context * @return the application context (never {@code null})
* @throws IllegalStateException if an error occurs while retrieving the * @throws IllegalStateException if an error occurs while retrieving the
* application context * application context
*/ */
@ -62,7 +64,7 @@ public interface TestContext extends AttributeAccessor, Serializable {
/** /**
* Get the current {@linkplain Object test instance} for this test context. * Get the current {@linkplain Object test instance} for this test context.
* <p>Note: this is a mutable property. * <p>Note: this is a mutable property.
* @return the current test instance (may be {@code null}) * @return the current test instance (never {@code null})
* @see #updateState(Object, Method, Throwable) * @see #updateState(Object, Method, Throwable)
*/ */
Object getTestInstance(); Object getTestInstance();
@ -70,7 +72,7 @@ public interface TestContext extends AttributeAccessor, Serializable {
/** /**
* Get the current {@linkplain Method test method} for this test context. * Get the current {@linkplain Method test method} for this test context.
* <p>Note: this is a mutable property. * <p>Note: this is a mutable property.
* @return the current test method * @return the current test method (never {@code null})
* @see #updateState(Object, Method, Throwable) * @see #updateState(Object, Method, Throwable)
*/ */
Method getTestMethod(); Method getTestMethod();

5
spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultMockServerSpec.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.test.web.reactive.server; package org.springframework.test.web.reactive.server;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -32,7 +33,7 @@ class DefaultMockServerSpec extends AbstractMockServerSpec<DefaultMockServerSpec
DefaultMockServerSpec(WebHandler webHandler) { DefaultMockServerSpec(WebHandler webHandler) {
Assert.notNull(webHandler, "'WebHandler' is required"); Assert.notNull(webHandler, "WebHandler is required");
this.webHandler = webHandler; this.webHandler = webHandler;
} }

5
spring-test/src/main/java/org/springframework/test/web/reactive/server/MockServerConfigurer.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.test.web.reactive.server; package org.springframework.test.web.reactive.server;
import org.springframework.web.server.adapter.WebHttpHandlerBuilder; import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
@ -51,7 +52,7 @@ public interface MockServerConfigurer {
/** /**
* Invoked just before the mock server is built. Use this hook to inspect * Invoked just before the mock server is built. Use this hook to inspect
* and/or modify application-declared filtes and exception handlers, * and/or modify application-declared filters and exception handlers.
* @param builder the builder for the {@code HttpHandler} that will handle * @param builder the builder for the {@code HttpHandler} that will handle
* requests (i.e. the mock server) * requests (i.e. the mock server)
*/ */

3
spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClientConfigurer.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.test.web.reactive.server; package org.springframework.test.web.reactive.server;
import org.springframework.http.client.reactive.ClientHttpConnector; import org.springframework.http.client.reactive.ClientHttpConnector;

4
spring-web/src/main/java/org/springframework/http/server/reactive/ChannelSendOperator.java

@ -42,6 +42,7 @@ import org.springframework.util.Assert;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @author Stephane Maldini * @author Stephane Maldini
* @since 5.0 * @since 5.0
* @param <T> the type of element signaled
*/ */
public class ChannelSendOperator<T> extends Mono<Void> implements Scannable { public class ChannelSendOperator<T> extends Mono<Void> implements Scannable {
@ -77,7 +78,7 @@ public class ChannelSendOperator<T> extends Mono<Void> implements Scannable {
private enum State { private enum State {
/** No emissions from the upstream source yet */ /** No emissions from the upstream source yet. */
NEW, NEW,
/** /**
@ -337,6 +338,7 @@ public class ChannelSendOperator<T> extends Mono<Void> implements Scannable {
private final WriteBarrier writeBarrier; private final WriteBarrier writeBarrier;
@Nullable
private Subscription subscription; private Subscription subscription;

52
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/AbstractRequestCondition.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,9 +27,35 @@ import org.springframework.lang.Nullable;
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 5.0 * @since 5.0
* @param <T> the type of objects that this RequestCondition can be combined
* with and compared to
*/ */
public abstract class AbstractRequestCondition<T extends AbstractRequestCondition<T>> implements RequestCondition<T> { public abstract class AbstractRequestCondition<T extends AbstractRequestCondition<T>> implements RequestCondition<T> {
/**
* Indicates whether this condition is empty, i.e. whether or not it
* contains any discrete items.
* @return {@code true} if empty; {@code false} otherwise
*/
public boolean isEmpty() {
return getContent().isEmpty();
}
/**
* Return the discrete items a request condition is composed of.
* <p>For example URL patterns, HTTP request methods, param expressions, etc.
* @return a collection of objects (never {@code null})
*/
protected abstract Collection<?> getContent();
/**
* The notation to use when printing discrete items of content.
* <p>For example {@code " || "} for URL patterns or {@code " && "}
* for param expressions.
*/
protected abstract String getToStringInfix();
@Override @Override
public boolean equals(@Nullable Object other) { public boolean equals(@Nullable Object other) {
if (this == other) { if (this == other) {
@ -60,28 +86,4 @@ public abstract class AbstractRequestCondition<T extends AbstractRequestConditio
return builder.toString(); return builder.toString();
} }
/**
* Indicates whether this condition is empty, i.e. whether or not it
* contains any discrete items.
* @return {@code true} if empty; {@code false} otherwise
*/
public boolean isEmpty() {
return getContent().isEmpty();
}
/**
* Return the discrete items a request condition is composed of.
* <p>For example URL patterns, HTTP request methods, param expressions, etc.
* @return a collection of objects, never {@code null}
*/
protected abstract Collection<?> getContent();
/**
* The notation to use when printing discrete items of content.
* <p>For example {@code " || "} for URL patterns or {@code " && "}
* for param expressions.
*/
protected abstract String getToStringInfix();
} }

6
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,6 +27,8 @@ import org.springframework.lang.Nullable;
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 3.1 * @since 3.1
* @param <T> the type of objects that this RequestCondition can be combined
* with and compared to
*/ */
public abstract class AbstractRequestCondition<T extends AbstractRequestCondition<T>> implements RequestCondition<T> { public abstract class AbstractRequestCondition<T extends AbstractRequestCondition<T>> implements RequestCondition<T> {
@ -42,7 +44,7 @@ public abstract class AbstractRequestCondition<T extends AbstractRequestConditio
/** /**
* Return the discrete items a request condition is composed of. * Return the discrete items a request condition is composed of.
* <p>For example URL patterns, HTTP request methods, param expressions, etc. * <p>For example URL patterns, HTTP request methods, param expressions, etc.
* @return a collection of objects, never {@code null} * @return a collection of objects (never {@code null})
*/ */
protected abstract Collection<?> getContent(); protected abstract Collection<?> getContent();

Loading…
Cancel
Save