parent
da323d3335
commit
271f2dc665
|
@ -287,7 +287,7 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
|
||||||
RootBeanDefinition beanDefinition = registeredBean.getMergedBeanDefinition();
|
RootBeanDefinition beanDefinition = registeredBean.getMergedBeanDefinition();
|
||||||
InjectionMetadata metadata = findInjectionMetadata(beanName, beanClass, beanDefinition);
|
InjectionMetadata metadata = findInjectionMetadata(beanName, beanClass, beanDefinition);
|
||||||
Collection<AutowiredElement> autowiredElements = getAutowiredElements(metadata,
|
Collection<AutowiredElement> autowiredElements = getAutowiredElements(metadata,
|
||||||
registeredBean.getMergedBeanDefinition().getPropertyValues());
|
beanDefinition.getPropertyValues());
|
||||||
if (!ObjectUtils.isEmpty(autowiredElements)) {
|
if (!ObjectUtils.isEmpty(autowiredElements)) {
|
||||||
return new AotContribution(beanClass, autowiredElements, getAutowireCandidateResolver());
|
return new AotContribution(beanClass, autowiredElements, getAutowireCandidateResolver());
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* Uses an {@linkplain Dispatchers#getUnconfined() unconfined} dispatcher.
|
||||||
* @param method the suspending function to invoke
|
* @param method the suspending function to invoke
|
||||||
* @param target the target to invoke {@code method} on
|
* @param target the target to invoke {@code method} on
|
||||||
|
@ -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}.
|
* {@link Flux}.
|
||||||
* @param context the coroutine context to use
|
* @param context the coroutine context to use
|
||||||
* @param method the suspending function to invoke
|
* @param method the suspending function to invoke
|
||||||
|
|
|
@ -349,9 +349,9 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private Method findGetterForProperty(String propertyName, Class<?> clazz, Object target) {
|
private Method findGetterForProperty(String propertyName, Class<?> clazz, Object target) {
|
||||||
boolean targetIsaClass = (target instanceof Class);
|
boolean targetIsAClass = (target instanceof Class);
|
||||||
Method method = findGetterForProperty(propertyName, clazz, targetIsaClass);
|
Method method = findGetterForProperty(propertyName, clazz, targetIsAClass);
|
||||||
if (method == null && targetIsaClass) {
|
if (method == null && targetIsAClass) {
|
||||||
// Fallback for getter instance methods in java.lang.Class.
|
// Fallback for getter instance methods in java.lang.Class.
|
||||||
method = findGetterForProperty(propertyName, Class.class, false);
|
method = findGetterForProperty(propertyName, Class.class, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,7 +544,7 @@ class EvaluationTests extends AbstractExpressionTests {
|
||||||
|
|
||||||
pattern += "?";
|
pattern += "?";
|
||||||
assertThat(pattern).hasSize(1001);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ class KotlinSpelReproTests {
|
||||||
val expr = parser.parseExpression("#key.startsWith('hello')")
|
val expr = parser.parseExpression("#key.startsWith('hello')")
|
||||||
context.registerFunction("suspendingGet", Config::class.java.getMethod("suspendingGet", String::class.java, Continuation::class.java))
|
context.registerFunction("suspendingGet", Config::class.java.getMethod("suspendingGet", String::class.java, Continuation::class.java))
|
||||||
context.setVariable("key", "hello world")
|
context.setVariable("key", "hello world")
|
||||||
assertThat(expr .getValue(context, Boolean::class.java)).isTrue()
|
assertThat(expr.getValue(context, Boolean::class.java)).isTrue()
|
||||||
context.setVariable("key", "")
|
context.setVariable("key", "")
|
||||||
assertThat(expr.getValue(context, Boolean::class.java)).isFalse()
|
assertThat(expr.getValue(context, Boolean::class.java)).isFalse()
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,7 +348,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
||||||
}
|
}
|
||||||
// Create new (method local) connection, which is later assigned to instance connection
|
// Create new (method local) connection, which is later assigned to instance connection
|
||||||
// - prevention to hold instance connection without exception listener, in case when
|
// - 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();
|
Connection con = doCreateConnection();
|
||||||
try {
|
try {
|
||||||
prepareConnection(con);
|
prepareConnection(con);
|
||||||
|
@ -360,9 +360,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
||||||
con.close();
|
con.close();
|
||||||
}
|
}
|
||||||
catch(Throwable th) {
|
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;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,7 +360,7 @@ public class PersistenceAnnotationBeanPostProcessor implements InstantiationAwar
|
||||||
RootBeanDefinition beanDefinition = registeredBean.getMergedBeanDefinition();
|
RootBeanDefinition beanDefinition = registeredBean.getMergedBeanDefinition();
|
||||||
InjectionMetadata metadata = findInjectionMetadata(beanDefinition, beanClass, beanName);
|
InjectionMetadata metadata = findInjectionMetadata(beanDefinition, beanClass, beanName);
|
||||||
Collection<InjectedElement> injectedElements = metadata.getInjectedElements(
|
Collection<InjectedElement> injectedElements = metadata.getInjectedElements(
|
||||||
registeredBean.getMergedBeanDefinition().getPropertyValues());
|
beanDefinition.getPropertyValues());
|
||||||
if (!CollectionUtils.isEmpty(injectedElements)) {
|
if (!CollectionUtils.isEmpty(injectedElements)) {
|
||||||
return new AotContribution(beanClass, injectedElements);
|
return new AotContribution(beanClass, injectedElements);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class CookieAssertionTests {
|
||||||
|
|
||||||
private static final String COOKIE_NAME = CookieLocaleResolver.DEFAULT_COOKIE_NAME;
|
private static final String COOKIE_NAME = CookieLocaleResolver.DEFAULT_COOKIE_NAME;
|
||||||
private static final String COOKIE_WITH_ATTRIBUTES_NAME = "SecondCookie";
|
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;
|
private MockMvc mockMvc;
|
||||||
|
|
||||||
|
|
|
@ -445,7 +445,7 @@ public abstract class AbstractReactiveTransactionManager implements ReactiveTran
|
||||||
return doCommit(synchronizationManager, status);
|
return doCommit(synchronizationManager, status);
|
||||||
}
|
}
|
||||||
return Mono.empty();
|
return Mono.empty();
|
||||||
})) //
|
}))
|
||||||
.onErrorResume(ex -> {
|
.onErrorResume(ex -> {
|
||||||
Mono<Void> propagateException = Mono.error(ex);
|
Mono<Void> propagateException = Mono.error(ex);
|
||||||
// Store result in a local variable in order to appease the
|
// Store result in a local variable in order to appease the
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.junit.jupiter.api.Test
|
||||||
import org.springframework.core.ParameterizedTypeReference
|
import org.springframework.core.ParameterizedTypeReference
|
||||||
import org.springframework.http.HttpStatus
|
import org.springframework.http.HttpStatus
|
||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
import org.springframework.lang.Nullable
|
|
||||||
import org.springframework.web.service.annotation.GetExchange
|
import org.springframework.web.service.annotation.GetExchange
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +64,7 @@ class KotlinHttpServiceMethodTests {
|
||||||
verifyClientInvocation("requestToEntityFlux", object : ParameterizedTypeReference<String>() {})
|
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.invokedMethodName).isEqualTo(methodName)
|
||||||
assertThat(client.bodyType).isEqualTo(expectedBodyType)
|
assertThat(client.bodyType).isEqualTo(expectedBodyType)
|
||||||
}
|
}
|
||||||
|
|
|
@ -738,7 +738,7 @@ class DefaultWebClient implements WebClient {
|
||||||
|
|
||||||
private final ClientRequestObservationContext observationContext;
|
private final ClientRequestObservationContext observationContext;
|
||||||
|
|
||||||
public ObservationFilterFunction(ClientRequestObservationContext observationContext) {
|
ObservationFilterFunction(ClientRequestObservationContext observationContext) {
|
||||||
this.observationContext = observationContext;
|
this.observationContext = observationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,14 +121,14 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServerResponse.BodyBuilder allow(HttpMethod... allowedMethods) {
|
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)));
|
this.headers.setAllow(new LinkedHashSet<>(Arrays.asList(allowedMethods)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServerResponse.BodyBuilder allow(Set<HttpMethod> allowedMethods) {
|
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);
|
this.headers.setAllow(allowedMethods);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -60,12 +60,12 @@ public class ParameterContentTypeResolverTests {
|
||||||
Map<String, MediaType> mapping = Collections.emptyMap();
|
Map<String, MediaType> mapping = Collections.emptyMap();
|
||||||
RequestedContentTypeResolver resolver = new ParameterContentTypeResolver(mapping);
|
RequestedContentTypeResolver resolver = new ParameterContentTypeResolver(mapping);
|
||||||
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
|
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);
|
mapping = Collections.singletonMap("HTML", MediaType.APPLICATION_XHTML_XML);
|
||||||
resolver = new ParameterContentTypeResolver(mapping);
|
resolver = new ParameterContentTypeResolver(mapping);
|
||||||
mediaTypes = resolver.resolveMediaTypes(exchange);
|
mediaTypes = resolver.resolveMediaTypes(exchange);
|
||||||
assertThat(mediaTypes).isEqualTo(Collections.singletonList(new MediaType("application", "xhtml+xml")));
|
assertThat(mediaTypes).containsExactly(new MediaType("application", "xhtml+xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -74,7 +74,7 @@ public class ParameterContentTypeResolverTests {
|
||||||
RequestedContentTypeResolver resolver = new ParameterContentTypeResolver(Collections.emptyMap());
|
RequestedContentTypeResolver resolver = new ParameterContentTypeResolver(Collections.emptyMap());
|
||||||
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
|
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
|
@Test // SPR-13747
|
||||||
|
@ -84,7 +84,7 @@ public class ParameterContentTypeResolverTests {
|
||||||
ParameterContentTypeResolver resolver = new ParameterContentTypeResolver(mapping);
|
ParameterContentTypeResolver resolver = new ParameterContentTypeResolver(mapping);
|
||||||
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
|
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) {
|
private MockServerWebExchange createExchange(String format) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class RequestedContentTypeResolverBuilderTests {
|
||||||
MockServerHttpRequest.get("/flower").accept(MediaType.IMAGE_GIF));
|
MockServerHttpRequest.get("/flower").accept(MediaType.IMAGE_GIF));
|
||||||
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
|
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
|
||||||
|
|
||||||
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.IMAGE_GIF));
|
assertThat(mediaTypes).containsExactly(MediaType.IMAGE_GIF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -52,7 +52,7 @@ public class RequestedContentTypeResolverBuilderTests {
|
||||||
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/flower?format=json"));
|
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/flower?format=json"));
|
||||||
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
|
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
|
||||||
|
|
||||||
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
|
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -87,11 +87,11 @@ public class RequestedContentTypeResolverBuilderTests {
|
||||||
|
|
||||||
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
|
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
|
||||||
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
|
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));
|
exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").accept(MediaType.ALL));
|
||||||
mediaTypes = resolver.resolveMediaTypes(exchange);
|
mediaTypes = resolver.resolveMediaTypes(exchange);
|
||||||
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
|
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -104,7 +104,7 @@ public class RequestedContentTypeResolverBuilderTests {
|
||||||
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/")
|
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/")
|
||||||
.accept(MediaType.valueOf("*/*;q=0.8")));
|
.accept(MediaType.valueOf("*/*;q=0.8")));
|
||||||
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
|
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
|
||||||
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
|
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue