Browse Source

Merge branch '6.0.x'

pull/30739/head
Sam Brannen 1 year ago
parent
commit
b8a713fde3
  1. 2
      spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
  2. 4
      spring-core/src/main/java/org/springframework/core/CoroutinesUtils.java
  3. 6
      spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java
  4. 2
      spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java
  5. 2
      spring-expression/src/test/kotlin/org/springframework/expression/spel/KotlinSpelReproTests.kt
  6. 6
      spring-jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java
  7. 2
      spring-orm/src/main/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.java
  8. 2
      spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/CookieAssertionTests.java
  9. 2
      spring-tx/src/main/java/org/springframework/transaction/reactive/AbstractReactiveTransactionManager.java
  10. 3
      spring-web/src/test/kotlin/org/springframework/web/service/invoker/KotlinHttpServiceMethodTests.kt
  11. 2
      spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java
  12. 4
      spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java
  13. 10
      spring-webflux/src/test/java/org/springframework/web/reactive/accept/ParameterContentTypeResolverTests.java
  14. 10
      spring-webflux/src/test/java/org/springframework/web/reactive/accept/RequestedContentTypeResolverBuilderTests.java

2
spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java

@ -287,7 +287,7 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA @@ -287,7 +287,7 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
RootBeanDefinition beanDefinition = registeredBean.getMergedBeanDefinition();
InjectionMetadata metadata = findInjectionMetadata(beanName, beanClass, beanDefinition);
Collection<AutowiredElement> autowiredElements = getAutowiredElements(metadata,
registeredBean.getMergedBeanDefinition().getPropertyValues());
beanDefinition.getPropertyValues());
if (!ObjectUtils.isEmpty(autowiredElements)) {
return new AotContribution(beanClass, autowiredElements, getAutowireCandidateResolver());
}

4
spring-core/src/main/java/org/springframework/core/CoroutinesUtils.java

@ -70,7 +70,7 @@ public abstract class CoroutinesUtils { @@ -70,7 +70,7 @@ public abstract class CoroutinesUtils {
}
/**
* Invoke a suspending function and converts it to {@link Mono} or {@link Flux}.
* Invoke a suspending function and convert it to {@link Mono} or {@link Flux}.
* Uses an {@linkplain Dispatchers#getUnconfined() unconfined} dispatcher.
* @param method the suspending function to invoke
* @param target the target to invoke {@code method} on
@ -85,7 +85,7 @@ public abstract class CoroutinesUtils { @@ -85,7 +85,7 @@ public abstract class CoroutinesUtils {
}
/**
* Invoke a suspending function and converts it to {@link Mono} or
* Invoke a suspending function and convert it to {@link Mono} or
* {@link Flux}.
* @param context the coroutine context to use
* @param method the suspending function to invoke

6
spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java

@ -349,9 +349,9 @@ public class ReflectivePropertyAccessor implements PropertyAccessor { @@ -349,9 +349,9 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
@Nullable
private Method findGetterForProperty(String propertyName, Class<?> clazz, Object target) {
boolean targetIsaClass = (target instanceof Class);
Method method = findGetterForProperty(propertyName, clazz, targetIsaClass);
if (method == null && targetIsaClass) {
boolean targetIsAClass = (target instanceof Class);
Method method = findGetterForProperty(propertyName, clazz, targetIsAClass);
if (method == null && targetIsAClass) {
// Fallback for getter instance methods in java.lang.Class.
method = findGetterForProperty(propertyName, Class.class, false);
}

2
spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java

@ -544,7 +544,7 @@ class EvaluationTests extends AbstractExpressionTests { @@ -544,7 +544,7 @@ class EvaluationTests extends AbstractExpressionTests {
pattern += "?";
assertThat(pattern).hasSize(1001);
evaluateAndCheckError("'abc' matches '" + pattern + "'", Boolean.class, SpelMessage.MAX_REGEX_LENGTH_EXCEEDED);
evaluateAndCheckError("'X' matches '" + pattern + "'", Boolean.class, SpelMessage.MAX_REGEX_LENGTH_EXCEEDED);
}
}

2
spring-expression/src/test/kotlin/org/springframework/expression/spel/KotlinSpelReproTests.kt

@ -50,7 +50,7 @@ class KotlinSpelReproTests { @@ -50,7 +50,7 @@ class KotlinSpelReproTests {
val expr = parser.parseExpression("#key.startsWith('hello')")
context.registerFunction("suspendingGet", Config::class.java.getMethod("suspendingGet", String::class.java, Continuation::class.java))
context.setVariable("key", "hello world")
assertThat(expr .getValue(context, Boolean::class.java)).isTrue()
assertThat(expr.getValue(context, Boolean::class.java)).isTrue()
context.setVariable("key", "")
assertThat(expr.getValue(context, Boolean::class.java)).isFalse()
}

6
spring-jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java

@ -410,7 +410,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti @@ -410,7 +410,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
}
// Create new (method local) connection, which is later assigned to instance connection
// - prevention to hold instance connection without exception listener, in case when
// some subsequent methods (after creation of connection) throws JMSException
// some subsequent methods (after creation of connection) throw JMSException
Connection con = doCreateConnection();
try {
prepareConnection(con);
@ -422,9 +422,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti @@ -422,9 +422,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
con.close();
}
catch(Throwable th) {
if (logger.isDebugEnabled()) {
logger.debug("Could not close newly obtained JMS Connection that failed to prepare", th);
}
logger.debug("Could not close newly obtained JMS Connection that failed to prepare", th);
}
throw ex;
}

2
spring-orm/src/main/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.java

@ -360,7 +360,7 @@ public class PersistenceAnnotationBeanPostProcessor implements InstantiationAwar @@ -360,7 +360,7 @@ public class PersistenceAnnotationBeanPostProcessor implements InstantiationAwar
RootBeanDefinition beanDefinition = registeredBean.getMergedBeanDefinition();
InjectionMetadata metadata = findInjectionMetadata(beanDefinition, beanClass, beanName);
Collection<InjectedElement> injectedElements = metadata.getInjectedElements(
registeredBean.getMergedBeanDefinition().getPropertyValues());
beanDefinition.getPropertyValues());
if (!CollectionUtils.isEmpty(injectedElements)) {
return new AotContribution(beanClass, injectedElements);
}

2
spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/CookieAssertionTests.java

@ -49,7 +49,7 @@ public class CookieAssertionTests { @@ -49,7 +49,7 @@ public class CookieAssertionTests {
private static final String COOKIE_NAME = CookieLocaleResolver.DEFAULT_COOKIE_NAME;
private static final String COOKIE_WITH_ATTRIBUTES_NAME = "SecondCookie";
protected static final String SECOND_COOKIE_ATTRIBUTE = "COOKIE_ATTRIBUTE";
private static final String SECOND_COOKIE_ATTRIBUTE = "COOKIE_ATTRIBUTE";
private MockMvc mockMvc;

2
spring-tx/src/main/java/org/springframework/transaction/reactive/AbstractReactiveTransactionManager.java

@ -445,7 +445,7 @@ public abstract class AbstractReactiveTransactionManager implements ReactiveTran @@ -445,7 +445,7 @@ public abstract class AbstractReactiveTransactionManager implements ReactiveTran
return doCommit(synchronizationManager, status);
}
return Mono.empty();
})) //
}))
.onErrorResume(ex -> {
Mono<Void> propagateException = Mono.error(ex);
// Store result in a local variable in order to appease the

3
spring-web/src/test/kotlin/org/springframework/web/service/invoker/KotlinHttpServiceMethodTests.kt

@ -24,7 +24,6 @@ import org.junit.jupiter.api.Test @@ -24,7 +24,6 @@ import org.junit.jupiter.api.Test
import org.springframework.core.ParameterizedTypeReference
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.lang.Nullable
import org.springframework.web.service.annotation.GetExchange
/**
@ -65,7 +64,7 @@ class KotlinHttpServiceMethodTests { @@ -65,7 +64,7 @@ class KotlinHttpServiceMethodTests {
verifyClientInvocation("requestToEntityFlux", object : ParameterizedTypeReference<String>() {})
}
private fun verifyClientInvocation(methodName: String, @Nullable expectedBodyType: ParameterizedTypeReference<*>) {
private fun verifyClientInvocation(methodName: String, expectedBodyType: ParameterizedTypeReference<*>) {
assertThat(client.invokedMethodName).isEqualTo(methodName)
assertThat(client.bodyType).isEqualTo(expectedBodyType)
}

2
spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java

@ -738,7 +738,7 @@ class DefaultWebClient implements WebClient { @@ -738,7 +738,7 @@ class DefaultWebClient implements WebClient {
private final ClientRequestObservationContext observationContext;
public ObservationFilterFunction(ClientRequestObservationContext observationContext) {
ObservationFilterFunction(ClientRequestObservationContext observationContext) {
this.observationContext = observationContext;
}

4
spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java

@ -121,14 +121,14 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder { @@ -121,14 +121,14 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder {
@Override
public ServerResponse.BodyBuilder allow(HttpMethod... allowedMethods) {
Assert.notNull(allowedMethods, "Http allowedMethod must not be null");
Assert.notNull(allowedMethods, "Http allowedMethods must not be null");
this.headers.setAllow(new LinkedHashSet<>(Arrays.asList(allowedMethods)));
return this;
}
@Override
public ServerResponse.BodyBuilder allow(Set<HttpMethod> allowedMethods) {
Assert.notNull(allowedMethods, "Http allowedMethod must not be null");
Assert.notNull(allowedMethods, "Http allowedMethods must not be null");
this.headers.setAllow(allowedMethods);
return this;
}

10
spring-webflux/src/test/java/org/springframework/web/reactive/accept/ParameterContentTypeResolverTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2023 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.
@ -60,12 +60,12 @@ public class ParameterContentTypeResolverTests { @@ -60,12 +60,12 @@ public class ParameterContentTypeResolverTests {
Map<String, MediaType> mapping = Collections.emptyMap();
RequestedContentTypeResolver resolver = new ParameterContentTypeResolver(mapping);
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(new MediaType("text", "html")));
assertThat(mediaTypes).containsExactly(new MediaType("text", "html"));
mapping = Collections.singletonMap("HTML", MediaType.APPLICATION_XHTML_XML);
resolver = new ParameterContentTypeResolver(mapping);
mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(new MediaType("application", "xhtml+xml")));
assertThat(mediaTypes).containsExactly(new MediaType("application", "xhtml+xml"));
}
@Test
@ -74,7 +74,7 @@ public class ParameterContentTypeResolverTests { @@ -74,7 +74,7 @@ public class ParameterContentTypeResolverTests {
RequestedContentTypeResolver resolver = new ParameterContentTypeResolver(Collections.emptyMap());
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(new MediaType("application", "vnd.ms-excel")));
assertThat(mediaTypes).containsExactly(new MediaType("application", "vnd.ms-excel"));
}
@Test // SPR-13747
@ -84,7 +84,7 @@ public class ParameterContentTypeResolverTests { @@ -84,7 +84,7 @@ public class ParameterContentTypeResolverTests {
ParameterContentTypeResolver resolver = new ParameterContentTypeResolver(mapping);
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
}
private MockServerWebExchange createExchange(String format) {

10
spring-webflux/src/test/java/org/springframework/web/reactive/accept/RequestedContentTypeResolverBuilderTests.java

@ -40,7 +40,7 @@ public class RequestedContentTypeResolverBuilderTests { @@ -40,7 +40,7 @@ public class RequestedContentTypeResolverBuilderTests {
MockServerHttpRequest.get("/flower").accept(MediaType.IMAGE_GIF));
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.IMAGE_GIF));
assertThat(mediaTypes).containsExactly(MediaType.IMAGE_GIF);
}
@Test
@ -52,7 +52,7 @@ public class RequestedContentTypeResolverBuilderTests { @@ -52,7 +52,7 @@ public class RequestedContentTypeResolverBuilderTests {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/flower?format=json"));
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
}
@Test
@ -87,11 +87,11 @@ public class RequestedContentTypeResolverBuilderTests { @@ -87,11 +87,11 @@ public class RequestedContentTypeResolverBuilderTests {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").accept(MediaType.ALL));
mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
}
@Test
@ -104,7 +104,7 @@ public class RequestedContentTypeResolverBuilderTests { @@ -104,7 +104,7 @@ public class RequestedContentTypeResolverBuilderTests {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/")
.accept(MediaType.valueOf("*/*;q=0.8")));
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
}
}

Loading…
Cancel
Save