Merge branch '5.3.x'

# Conflicts:
#	spring-context/src/test/java/org/springframework/context/annotation/Gh29105Tests.java
This commit is contained in:
Sam Brannen 2022-11-08 12:27:40 +01:00
commit e1010a179f
5 changed files with 15 additions and 17 deletions

View File

@ -16,8 +16,7 @@
package org.springframework.context.annotation;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
@ -30,25 +29,23 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Stephane Nicoll
*/
public class Gh29105Tests {
class Gh29105Tests {
@Test
void beanProviderWithParentContextReuseOrder() {
AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext();
parent.register(DefaultConfiguration.class);
parent.register(CustomConfiguration.class);
parent.refresh();
AnnotationConfigApplicationContext parent =
new AnnotationConfigApplicationContext(DefaultConfiguration.class, CustomConfiguration.class);
AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext();
child.setParent(parent);
child.register(DefaultConfiguration.class);
child.refresh();
List<Class<?>> orderedTypes = child.getBeanProvider(MyService.class)
.orderedStream().map(Object::getClass).collect(Collectors.toList());
Stream<Class<?>> orderedTypes = child.getBeanProvider(MyService.class).orderedStream().map(Object::getClass);
assertThat(orderedTypes).containsExactly(CustomService.class, DefaultService.class);
parent.close();
child.close();
parent.close();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -57,7 +57,7 @@ final class TransactionalOperatorImpl implements TransactionalOperator {
*/
TransactionalOperatorImpl(ReactiveTransactionManager transactionManager, TransactionDefinition transactionDefinition) {
Assert.notNull(transactionManager, "ReactiveTransactionManager must not be null");
Assert.notNull(transactionManager, "TransactionDefinition must not be null");
Assert.notNull(transactionDefinition, "TransactionDefinition must not be null");
this.transactionManager = transactionManager;
this.transactionDefinition = transactionDefinition;
}

View File

@ -492,8 +492,9 @@ public final class ContentDisposition {
* @see <a href="https://tools.ietf.org/html/rfc5987">RFC 5987</a>
*/
private static String decodeFilename(String filename, Charset charset) {
Assert.notNull(filename, "'input' String should not be null");
Assert.notNull(charset, "'charset' should not be null");
Assert.notNull(filename, "'filename' must not be null");
Assert.notNull(charset, "'charset' must not be null");
byte[] value = filename.getBytes(charset);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int index = 0;

View File

@ -64,12 +64,12 @@ class UndertowServerHttpResponse extends AbstractListenerServerHttpResponse impl
HttpServerExchange exchange, DataBufferFactory bufferFactory, UndertowServerHttpRequest request) {
super(bufferFactory, createHeaders(exchange));
Assert.notNull(exchange, "HttpServerExchange must not be null");
this.exchange = exchange;
this.request = request;
}
private static HttpHeaders createHeaders(HttpServerExchange exchange) {
Assert.notNull(exchange, "HttpServerExchange must not be null");
UndertowHeadersAdapter headersMap = new UndertowHeadersAdapter(exchange.getResponseHeaders());
return new HttpHeaders(headersMap);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -59,7 +59,7 @@ public class RequestMatchResult {
*/
public RequestMatchResult(PathPattern pathPattern, PathContainer lookupPath) {
Assert.notNull(pathPattern, "PathPattern is required");
Assert.notNull(pathPattern, "PathContainer is required");
Assert.notNull(lookupPath, "PathContainer is required");
this.pattern = null;
this.lookupPath = null;