Move Spring dependencies to SNAPSHOTs
* Use a `DefaultParameterNameDiscoverer` instead of deprecated `LocalVariableTableParameterNameDiscoverer` * Fix assertion error message for `@Header` without `name` and with no `-parameters` compiler flag. * Remove redundant repos for Gradle plugins Related to: https://stackoverflow.com/questions/74600681/warning-printed-after-migrating-to-spring-boot-3-0-spring-integration-6-0
This commit is contained in:
22
build.gradle
22
build.gradle
@@ -2,13 +2,7 @@ buildscript {
|
||||
ext.kotlinVersion = '1.7.21'
|
||||
ext.isCI = System.getenv('GITHUB_ACTION') || System.getenv('bamboo_buildKey')
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
jcenter() {
|
||||
content {
|
||||
includeGroup('com.burgstaller')
|
||||
}
|
||||
}
|
||||
maven { url 'https://repo.spring.io/plugins-release' }
|
||||
if (version.endsWith('SNAPSHOT')) {
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
@@ -107,14 +101,14 @@ ext {
|
||||
rsocketVersion = '1.1.3'
|
||||
servletApiVersion = '6.0.0'
|
||||
smackVersion = '4.4.6'
|
||||
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '3.0.0'
|
||||
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2022.0.0'
|
||||
springGraphqlVersion = '1.1.0'
|
||||
springKafkaVersion = '3.0.0'
|
||||
springRetryVersion = '2.0.0'
|
||||
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '6.0.0'
|
||||
springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.0.0'
|
||||
springWsVersion = '4.0.0'
|
||||
springAmqpVersion = '3.0.1-SNAPSHOT'
|
||||
springDataVersion = '2022.0.1-SNAPSHOT'
|
||||
springGraphqlVersion = '1.1.1-SNAPSHOT'
|
||||
springKafkaVersion = '3.0.1-SNAPSHOT'
|
||||
springRetryVersion = '2.0.1-SNAPSHOT'
|
||||
springSecurityVersion = '6.0.1-SNAPSHOT'
|
||||
springVersion = '6.0.3-SNAPSHOT'
|
||||
springWsVersion = '4.0.1-SNAPSHOT'
|
||||
testcontainersVersion = '1.17.6'
|
||||
tomcatVersion = '10.1.1'
|
||||
xmlUnitVersion = '2.9.0'
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
||||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
@@ -60,7 +60,7 @@ public class MessagePublishingInterceptor implements MethodInterceptor, BeanFact
|
||||
|
||||
private final MessagingTemplate messagingTemplate = new MessagingTemplate();
|
||||
|
||||
private final ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
|
||||
private final ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
|
||||
|
||||
private final PublisherMetadataSource metadataSource;
|
||||
|
||||
@@ -113,7 +113,7 @@ public class MessagePublishingInterceptor implements MethodInterceptor, BeanFact
|
||||
initMessagingTemplateIfAny();
|
||||
StandardEvaluationContext context = ExpressionUtils.createStandardEvaluationContext(this.beanFactory);
|
||||
Class<?> targetClass = AopUtils.getTargetClass(invocation.getThis());
|
||||
final Method method = AopUtils.getMostSpecificMethod(invocation.getMethod(), targetClass);
|
||||
Method method = AopUtils.getMostSpecificMethod(invocation.getMethod(), targetClass);
|
||||
String[] argumentNames = resolveArgumentNames(method);
|
||||
context.setVariable(PublisherMetadataSource.METHOD_NAME_VARIABLE_NAME, method.getName());
|
||||
if (invocation.getArguments().length > 0 && argumentNames != null) {
|
||||
|
||||
@@ -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.
|
||||
@@ -25,7 +25,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
||||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.core.annotation.MergedAnnotation;
|
||||
import org.springframework.core.annotation.MergedAnnotations;
|
||||
@@ -52,7 +52,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class MethodAnnotationPublisherMetadataSource implements PublisherMetadataSource {
|
||||
|
||||
private final ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
|
||||
private final ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
|
||||
|
||||
private final Map<Method, String> channels = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
||||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
@@ -89,6 +89,8 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper<Object[]
|
||||
|
||||
private static final SpelExpressionParser PARSER = new SpelExpressionParser();
|
||||
|
||||
private static final ParameterNameDiscoverer PARAMETER_NAME_DISCOVERER = new DefaultParameterNameDiscoverer();
|
||||
|
||||
private final Map<String, Expression> parameterPayloadExpressions = new HashMap<>();
|
||||
|
||||
private final Method method;
|
||||
@@ -242,17 +244,16 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper<Object[]
|
||||
static String determineHeaderName(Annotation headerAnnotation, MethodParameter methodParameter) {
|
||||
String valueAttribute = (String) AnnotationUtils.getValue(headerAnnotation);
|
||||
String headerName = StringUtils.hasText(valueAttribute) ? valueAttribute : methodParameter.getParameterName();
|
||||
Assert.notNull(headerName, "Cannot determine header name. Possible reasons: -debug is " +
|
||||
Assert.notNull(headerName, "Cannot determine header name. Possible reasons: the -parameters compiler flag is " +
|
||||
"disabled or header name is not explicitly provided via @Header annotation.");
|
||||
return headerName;
|
||||
}
|
||||
|
||||
static List<MethodParameter> getMethodParameterList(Method method) {
|
||||
List<MethodParameter> parameterList = new LinkedList<>();
|
||||
ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
|
||||
for (int i = 0; i < method.getParameterCount(); i++) {
|
||||
MethodParameter methodParameter = new SynthesizingMethodParameter(method, i);
|
||||
methodParameter.initParameterNameDiscovery(parameterNameDiscoverer);
|
||||
methodParameter.initParameterNameDiscovery(PARAMETER_NAME_DISCOVERER);
|
||||
parameterList.add(methodParameter);
|
||||
}
|
||||
return parameterList;
|
||||
|
||||
@@ -49,8 +49,8 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.context.expression.StandardBeanExpressionResolver;
|
||||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||
import org.springframework.core.KotlinDetector;
|
||||
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
@@ -143,8 +143,7 @@ public class MessagingMethodInvokerHelper extends AbstractExpressionEvaluator im
|
||||
private static final ExpressionParser EXPRESSION_PARSER_MIXED =
|
||||
new SpelExpressionParser(new SpelParserConfiguration(SpelCompilerMode.MIXED, null));
|
||||
|
||||
private static final ParameterNameDiscoverer PARAMETER_NAME_DISCOVERER =
|
||||
new LocalVariableTableParameterNameDiscoverer();
|
||||
private static final ParameterNameDiscoverer PARAMETER_NAME_DISCOVERER = new DefaultParameterNameDiscoverer();
|
||||
|
||||
private static final Map<SpelCompilerMode, ExpressionParser> SPEL_COMPILERS = new HashMap<>();
|
||||
|
||||
@@ -1285,8 +1284,8 @@ public class MessagingMethodInvokerHelper extends AbstractExpressionEvaluator im
|
||||
}
|
||||
}
|
||||
|
||||
Assert.notNull(headerName, "Cannot determine header name. Possible reasons: -debug is "
|
||||
+ "disabled or header name is not explicitly provided via @Header annotation.");
|
||||
Assert.notNull(headerName, "Cannot determine header name. Possible reasons: the -parameters compiler flag "
|
||||
+ "is disabled or header name is not explicitly provided via @Header annotation.");
|
||||
String headerRetrievalExpression = "headers['" + headerName + "']";
|
||||
String fullHeaderExpression = headerRetrievalExpression + relativeExpression;
|
||||
if (annotationAttributes.getBoolean("required")
|
||||
|
||||
Reference in New Issue
Block a user