Skip to content

Commit 532f323

Browse files
committed
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
1 parent dc6f5aa commit 532f323

File tree

5 files changed

+23
-29
lines changed

5 files changed

+23
-29
lines changed

build.gradle

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ buildscript {
22
ext.kotlinVersion = '1.7.21'
33
ext.isCI = System.getenv('GITHUB_ACTION') || System.getenv('bamboo_buildKey')
44
repositories {
5-
mavenCentral()
65
gradlePluginPortal()
7-
jcenter() {
8-
content {
9-
includeGroup('com.burgstaller')
10-
}
11-
}
126
maven { url 'https://repo.spring.io/plugins-release' }
137
if (version.endsWith('SNAPSHOT')) {
148
maven { url 'https://repo.spring.io/snapshot' }
@@ -107,14 +101,14 @@ ext {
107101
rsocketVersion = '1.1.3'
108102
servletApiVersion = '6.0.0'
109103
smackVersion = '4.4.6'
110-
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '3.0.0'
111-
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2022.0.0'
112-
springGraphqlVersion = '1.1.0'
113-
springKafkaVersion = '3.0.0'
114-
springRetryVersion = '2.0.0'
115-
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '6.0.0'
116-
springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.0.0'
117-
springWsVersion = '4.0.0'
104+
springAmqpVersion = '3.0.1-SNAPSHOT'
105+
springDataVersion = '2022.0.1-SNAPSHOT'
106+
springGraphqlVersion = '1.1.1-SNAPSHOT'
107+
springKafkaVersion = '3.0.1-SNAPSHOT'
108+
springRetryVersion = '2.0.1-SNAPSHOT'
109+
springSecurityVersion = '6.0.1-SNAPSHOT'
110+
springVersion = '6.0.3-SNAPSHOT'
111+
springWsVersion = '4.0.1-SNAPSHOT'
118112
testcontainersVersion = '1.17.6'
119113
tomcatVersion = '10.1.1'
120114
xmlUnitVersion = '2.9.0'

spring-integration-core/src/main/java/org/springframework/integration/aop/MessagePublishingInterceptor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.springframework.beans.BeansException;
2828
import org.springframework.beans.factory.BeanFactory;
2929
import org.springframework.beans.factory.BeanFactoryAware;
30-
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
30+
import org.springframework.core.DefaultParameterNameDiscoverer;
3131
import org.springframework.core.ParameterNameDiscoverer;
3232
import org.springframework.expression.Expression;
3333
import org.springframework.expression.spel.support.StandardEvaluationContext;
@@ -60,7 +60,7 @@ public class MessagePublishingInterceptor implements MethodInterceptor, BeanFact
6060

6161
private final MessagingTemplate messagingTemplate = new MessagingTemplate();
6262

63-
private final ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
63+
private final ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
6464

6565
private final PublisherMetadataSource metadataSource;
6666

@@ -113,7 +113,7 @@ public final Object invoke(MethodInvocation invocation) throws Throwable {
113113
initMessagingTemplateIfAny();
114114
StandardEvaluationContext context = ExpressionUtils.createStandardEvaluationContext(this.beanFactory);
115115
Class<?> targetClass = AopUtils.getTargetClass(invocation.getThis());
116-
final Method method = AopUtils.getMostSpecificMethod(invocation.getMethod(), targetClass);
116+
Method method = AopUtils.getMostSpecificMethod(invocation.getMethod(), targetClass);
117117
String[] argumentNames = resolveArgumentNames(method);
118118
context.setVariable(PublisherMetadataSource.METHOD_NAME_VARIABLE_NAME, method.getName());
119119
if (invocation.getArguments().length > 0 && argumentNames != null) {

spring-integration-core/src/main/java/org/springframework/integration/aop/MethodAnnotationPublisherMetadataSource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
import java.util.Set;
2626
import java.util.concurrent.ConcurrentHashMap;
2727

28-
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
28+
import org.springframework.core.DefaultParameterNameDiscoverer;
2929
import org.springframework.core.ParameterNameDiscoverer;
3030
import org.springframework.core.annotation.MergedAnnotation;
3131
import org.springframework.core.annotation.MergedAnnotations;
@@ -52,7 +52,7 @@
5252
*/
5353
public class MethodAnnotationPublisherMetadataSource implements PublisherMetadataSource {
5454

55-
private final ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
55+
private final ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
5656

5757
private final Map<Method, String> channels = new ConcurrentHashMap<>();
5858

spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapper.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
import org.springframework.beans.factory.BeanFactory;
3232
import org.springframework.beans.factory.BeanFactoryAware;
33-
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
33+
import org.springframework.core.DefaultParameterNameDiscoverer;
3434
import org.springframework.core.MethodParameter;
3535
import org.springframework.core.ParameterNameDiscoverer;
3636
import org.springframework.core.annotation.AnnotationUtils;
@@ -89,6 +89,8 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper<Object[]
8989

9090
private static final SpelExpressionParser PARSER = new SpelExpressionParser();
9191

92+
private static final ParameterNameDiscoverer PARAMETER_NAME_DISCOVERER = new DefaultParameterNameDiscoverer();
93+
9294
private final Map<String, Expression> parameterPayloadExpressions = new HashMap<>();
9395

9496
private final Method method;
@@ -242,17 +244,16 @@ private void throwExceptionForMultipleMessageOrPayloadParameters(MethodParameter
242244
static String determineHeaderName(Annotation headerAnnotation, MethodParameter methodParameter) {
243245
String valueAttribute = (String) AnnotationUtils.getValue(headerAnnotation);
244246
String headerName = StringUtils.hasText(valueAttribute) ? valueAttribute : methodParameter.getParameterName();
245-
Assert.notNull(headerName, "Cannot determine header name. Possible reasons: -debug is " +
247+
Assert.notNull(headerName, "Cannot determine header name. Possible reasons: the -parameters compiler flag is " +
246248
"disabled or header name is not explicitly provided via @Header annotation.");
247249
return headerName;
248250
}
249251

250252
static List<MethodParameter> getMethodParameterList(Method method) {
251253
List<MethodParameter> parameterList = new LinkedList<>();
252-
ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
253254
for (int i = 0; i < method.getParameterCount(); i++) {
254255
MethodParameter methodParameter = new SynthesizingMethodParameter(method, i);
255-
methodParameter.initParameterNameDiscovery(parameterNameDiscoverer);
256+
methodParameter.initParameterNameDiscovery(PARAMETER_NAME_DISCOVERER);
256257
parameterList.add(methodParameter);
257258
}
258259
return parameterList;

spring-integration-core/src/main/java/org/springframework/integration/handler/support/MessagingMethodInvokerHelper.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
5050
import org.springframework.context.Lifecycle;
5151
import org.springframework.context.expression.StandardBeanExpressionResolver;
52+
import org.springframework.core.DefaultParameterNameDiscoverer;
5253
import org.springframework.core.KotlinDetector;
53-
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
5454
import org.springframework.core.MethodParameter;
5555
import org.springframework.core.ParameterNameDiscoverer;
5656
import org.springframework.core.annotation.AnnotatedElementUtils;
@@ -143,8 +143,7 @@ public class MessagingMethodInvokerHelper extends AbstractExpressionEvaluator im
143143
private static final ExpressionParser EXPRESSION_PARSER_MIXED =
144144
new SpelExpressionParser(new SpelParserConfiguration(SpelCompilerMode.MIXED, null));
145145

146-
private static final ParameterNameDiscoverer PARAMETER_NAME_DISCOVERER =
147-
new LocalVariableTableParameterNameDiscoverer();
146+
private static final ParameterNameDiscoverer PARAMETER_NAME_DISCOVERER = new DefaultParameterNameDiscoverer();
148147

149148
private static final Map<SpelCompilerMode, ExpressionParser> SPEL_COMPILERS = new HashMap<>();
150149

@@ -1285,8 +1284,8 @@ else if (valueAttribute.indexOf('.') != -1) {
12851284
}
12861285
}
12871286

1288-
Assert.notNull(headerName, "Cannot determine header name. Possible reasons: -debug is "
1289-
+ "disabled or header name is not explicitly provided via @Header annotation.");
1287+
Assert.notNull(headerName, "Cannot determine header name. Possible reasons: the -parameters compiler flag "
1288+
+ "is disabled or header name is not explicitly provided via @Header annotation.");
12901289
String headerRetrievalExpression = "headers['" + headerName + "']";
12911290
String fullHeaderExpression = headerRetrievalExpression + relativeExpression;
12921291
if (annotationAttributes.getBoolean("required")

0 commit comments

Comments
 (0)