Declare interfaces as @FunctionalInterface where feasible

This commit declares each of the following public interfaces as a
@FunctionalInterface.

- org.springframework.context.ApplicationContextInitializer
- org.springframework.test.web.servlet.DispatcherServletCustomizer
- org.springframework.validation.MessageCodeFormatter
- org.springframework.util.IdGenerator
- org.springframework.beans.factory.config.YamlProcessor.MatchCallback
- org.springframework.beans.factory.config.YamlProcessor.DocumentMatcher

Closes gh-25580
This commit is contained in:
Sam Brannen 2020-08-11 17:01:03 +02:00
parent 596936f18c
commit c558391e2c
8 changed files with 82 additions and 104 deletions

View File

@ -351,6 +351,7 @@ public abstract class YamlProcessor {
/**
* Callback interface used to process the YAML parsing results.
*/
@FunctionalInterface
public interface MatchCallback {
/**
@ -367,6 +368,7 @@ public abstract class YamlProcessor {
/**
* Strategy interface used to test if properties match.
*/
@FunctionalInterface
public interface DocumentMatcher {
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@ -24,7 +24,6 @@ import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.DuplicateKeyException;
import org.yaml.snakeyaml.scanner.ScannerException;
import org.springframework.beans.factory.config.YamlProcessor.DocumentMatcher;
import org.springframework.beans.factory.config.YamlProcessor.MatchStatus;
import org.springframework.beans.factory.config.YamlProcessor.ResolutionMethod;
import org.springframework.core.io.ByteArrayResource;
@ -39,10 +38,10 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Dave Syer
* @author Juergen Hoeller
*/
public class YamlPropertiesFactoryBeanTests {
class YamlPropertiesFactoryBeanTests {
@Test
public void loadResource() {
void loadResource() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource("foo: bar\nspam:\n foo: baz".getBytes()));
Properties properties = factory.getObject();
@ -51,7 +50,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void badResource() {
void badResource() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource("foo: bar\ncd\nspam:\n foo: baz".getBytes()));
assertThatExceptionOfType(ScannerException.class)
@ -60,7 +59,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadResourcesWithOverride() {
void loadResourcesWithOverride() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(
new ByteArrayResource("foo: bar\nspam:\n foo: baz".getBytes()),
@ -72,7 +71,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadResourcesWithInternalOverride() {
void loadResourcesWithInternalOverride() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource(
"foo: bar\nspam:\n foo: baz\nfoo: bucket".getBytes()));
@ -80,7 +79,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadResourcesWithNestedInternalOverride() {
void loadResourcesWithNestedInternalOverride() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource(
"foo:\n bar: spam\n foo: baz\nbreak: it\nfoo: bucket".getBytes()));
@ -88,7 +87,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadResourceWithMultipleDocuments() {
void loadResourceWithMultipleDocuments() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource(
"foo: bar\nspam: baz\n---\nfoo: bag".getBytes()));
@ -98,7 +97,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadResourceWithSelectedDocuments() {
void loadResourceWithSelectedDocuments() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource(
"foo: bar\nspam: baz\n---\nfoo: bag\nspam: bad".getBytes()));
@ -110,7 +109,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadResourceWithDefaultMatch() {
void loadResourceWithDefaultMatch() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setMatchDefault(true);
factory.setResources(new ByteArrayResource(
@ -129,20 +128,17 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadResourceWithoutDefaultMatch() {
void loadResourceWithoutDefaultMatch() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setMatchDefault(false);
factory.setResources(new ByteArrayResource(
"one: two\n---\nfoo: bar\nspam: baz\n---\nfoo: bag\nspam: bad".getBytes()));
factory.setDocumentMatchers(new DocumentMatcher() {
@Override
public MatchStatus matches(Properties properties) {
factory.setDocumentMatchers(properties -> {
if (!properties.containsKey("foo")) {
return MatchStatus.ABSTAIN;
}
return ("bag".equals(properties.getProperty("foo")) ?
MatchStatus.FOUND : MatchStatus.NOT_FOUND);
}
});
Properties properties = factory.getObject();
assertThat(properties.getProperty("foo")).isEqualTo("bag");
@ -151,7 +147,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadResourceWithDefaultMatchSkippingMissedMatch() {
void loadResourceWithDefaultMatchSkippingMissedMatch() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setMatchDefault(true);
factory.setResources(new ByteArrayResource(
@ -170,7 +166,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadNonExistentResource() {
void loadNonExistentResource() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResolutionMethod(ResolutionMethod.OVERRIDE_AND_IGNORE);
factory.setResources(new ClassPathResource("no-such-file.yml"));
@ -179,7 +175,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadNull() {
void loadNull() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource("foo: bar\nspam:".getBytes()));
Properties properties = factory.getObject();
@ -188,7 +184,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadEmptyArrayValue() {
void loadEmptyArrayValue() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource("a: alpha\ntest: []".getBytes()));
Properties properties = factory.getObject();
@ -197,7 +193,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadArrayOfString() {
void loadArrayOfString() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource("foo:\n- bar\n- baz".getBytes()));
Properties properties = factory.getObject();
@ -207,7 +203,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadArrayOfInteger() {
void loadArrayOfInteger() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource("foo:\n- 1\n- 2".getBytes()));
Properties properties = factory.getObject();
@ -217,7 +213,7 @@ public class YamlPropertiesFactoryBeanTests {
}
@Test
public void loadArrayOfObject() {
void loadArrayOfObject() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource(
"foo:\n- bar:\n spam: crap\n- baz\n- one: two\n three: four".getBytes()
@ -232,7 +228,7 @@ public class YamlPropertiesFactoryBeanTests {
@Test
@SuppressWarnings("unchecked")
public void yaml() {
void yaml() {
Yaml yaml = new Yaml();
Map<String, ?> map = yaml.loadAs("foo: bar\nspam:\n foo: baz", Map.class);
assertThat(map.get("foo")).isEqualTo("bar");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.
@ -28,7 +28,7 @@ package org.springframework.context;
*
* <p>{@code ApplicationContextInitializer} processors are encouraged to detect
* whether Spring's {@link org.springframework.core.Ordered Ordered} interface has been
* implemented or if the @{@link org.springframework.core.annotation.Order Order}
* implemented or if the {@link org.springframework.core.annotation.Order @Order}
* annotation is present and to sort instances accordingly if so prior to invocation.
*
* @author Chris Beams
@ -39,6 +39,7 @@ package org.springframework.context;
* @see org.springframework.web.servlet.FrameworkServlet#setContextInitializerClasses
* @see org.springframework.web.servlet.FrameworkServlet#applyInitializers
*/
@FunctionalInterface
public interface ApplicationContextInitializer<C extends ConfigurableApplicationContext> {
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.
@ -26,6 +26,7 @@ import org.springframework.lang.Nullable;
* @see DefaultMessageCodesResolver
* @see DefaultMessageCodesResolver.Format
*/
@FunctionalInterface
public interface MessageCodeFormatter {
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@ -28,22 +28,20 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Phillip Webb
*/
public class DefaultMessageCodesResolverTests {
class DefaultMessageCodesResolverTests {
private final DefaultMessageCodesResolver resolver = new DefaultMessageCodesResolver();
private DefaultMessageCodesResolver resolver = new DefaultMessageCodesResolver();
@Test
public void shouldResolveMessageCode() throws Exception {
void shouldResolveMessageCode() throws Exception {
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName");
assertThat(codes).containsExactly(
"errorCode.objectName",
"errorCode");
assertThat(codes).containsExactly("errorCode.objectName", "errorCode");
}
@Test
public void shouldResolveFieldMessageCode() throws Exception {
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field",
TestBean.class);
void shouldResolveFieldMessageCode() throws Exception {
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field", TestBean.class);
assertThat(codes).containsExactly(
"errorCode.objectName.field",
"errorCode.field",
@ -52,9 +50,8 @@ public class DefaultMessageCodesResolverTests {
}
@Test
public void shouldResolveIndexedFieldMessageCode() throws Exception {
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "a.b[3].c[5].d",
TestBean.class);
void shouldResolveIndexedFieldMessageCode() throws Exception {
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "a.b[3].c[5].d", TestBean.class);
assertThat(codes).containsExactly(
"errorCode.objectName.a.b[3].c[5].d",
"errorCode.objectName.a.b[3].c.d",
@ -68,19 +65,16 @@ public class DefaultMessageCodesResolverTests {
}
@Test
public void shouldResolveMessageCodeWithPrefix() throws Exception {
void shouldResolveMessageCodeWithPrefix() throws Exception {
resolver.setPrefix("prefix.");
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName");
assertThat(codes).containsExactly(
"prefix.errorCode.objectName",
"prefix.errorCode");
assertThat(codes).containsExactly("prefix.errorCode.objectName", "prefix.errorCode");
}
@Test
public void shouldResolveFieldMessageCodeWithPrefix() throws Exception {
void shouldResolveFieldMessageCodeWithPrefix() throws Exception {
resolver.setPrefix("prefix.");
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field",
TestBean.class);
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field", TestBean.class);
assertThat(codes).containsExactly(
"prefix.errorCode.objectName.field",
"prefix.errorCode.field",
@ -89,10 +83,9 @@ public class DefaultMessageCodesResolverTests {
}
@Test
public void shouldSupportNullPrefix() throws Exception {
void shouldSupportNullPrefix() throws Exception {
resolver.setPrefix(null);
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field",
TestBean.class);
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field", TestBean.class);
assertThat(codes).containsExactly(
"errorCode.objectName.field",
"errorCode.field",
@ -101,9 +94,8 @@ public class DefaultMessageCodesResolverTests {
}
@Test
public void shouldSupportMalformedIndexField() throws Exception {
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field[",
TestBean.class);
void shouldSupportMalformedIndexField() throws Exception {
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field[", TestBean.class);
assertThat(codes).containsExactly(
"errorCode.objectName.field[",
"errorCode.field[",
@ -112,9 +104,8 @@ public class DefaultMessageCodesResolverTests {
}
@Test
public void shouldSupportNullFieldType() throws Exception {
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field",
null);
void shouldSupportNullFieldType() throws Exception {
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field", null);
assertThat(codes).containsExactly(
"errorCode.objectName.field",
"errorCode.field",
@ -122,19 +113,16 @@ public class DefaultMessageCodesResolverTests {
}
@Test
public void shouldSupportPostfixFormat() throws Exception {
void shouldSupportPostfixFormat() throws Exception {
resolver.setMessageCodeFormatter(Format.POSTFIX_ERROR_CODE);
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName");
assertThat(codes).containsExactly(
"objectName.errorCode",
"errorCode");
assertThat(codes).containsExactly("objectName.errorCode", "errorCode");
}
@Test
public void shouldSupportFieldPostfixFormat() throws Exception {
void shouldSupportFieldPostfixFormat() throws Exception {
resolver.setMessageCodeFormatter(Format.POSTFIX_ERROR_CODE);
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field",
TestBean.class);
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName", "field", TestBean.class);
assertThat(codes).containsExactly(
"objectName.field.errorCode",
"field.errorCode",
@ -143,18 +131,11 @@ public class DefaultMessageCodesResolverTests {
}
@Test
public void shouldSupportCustomFormat() throws Exception {
resolver.setMessageCodeFormatter(new MessageCodeFormatter() {
@Override
public String format(String errorCode, String objectName, String field) {
return DefaultMessageCodesResolver.Format.toDelimitedString(
"CUSTOM-" + errorCode, objectName, field);
}
});
void shouldSupportCustomFormat() throws Exception {
resolver.setMessageCodeFormatter((errorCode, objectName, field) ->
DefaultMessageCodesResolver.Format.toDelimitedString("CUSTOM-" + errorCode, objectName, field));
String[] codes = resolver.resolveMessageCodes("errorCode", "objectName");
assertThat(codes).containsExactly(
"CUSTOM-errorCode.objectName",
"CUSTOM-errorCode");
assertThat(codes).containsExactly("CUSTOM-errorCode.objectName", "CUSTOM-errorCode");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2020 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.
@ -19,11 +19,12 @@ package org.springframework.util;
import java.util.UUID;
/**
* Contract for generating universally unique identifiers {@link UUID (UUIDs)}.
* Contract for generating universally unique identifiers ({@link UUID UUIDs}).
*
* @author Rossen Stoyanchev
* @since 4.0
*/
@FunctionalInterface
public interface IdGenerator {
/**

View File

@ -26,7 +26,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
import org.springframework.util.IdGenerator;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
@ -36,16 +35,16 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
* @author Mark Fisher
* @author Rossen Stoyanchev
*/
public class MessageBuilderTests {
class MessageBuilderTests {
@Test
public void testSimpleMessageCreation() {
void simpleMessageCreation() {
Message<String> message = MessageBuilder.withPayload("foo").build();
assertThat(message.getPayload()).isEqualTo("foo");
}
@Test
public void testHeaderValues() {
void headerValues() {
Message<String> message = MessageBuilder.withPayload("test")
.setHeader("foo", "bar")
.setHeader("count", 123)
@ -55,7 +54,7 @@ public class MessageBuilderTests {
}
@Test
public void testCopiedHeaderValues() {
void copiedHeaderValues() {
Message<String> message1 = MessageBuilder.withPayload("test1")
.setHeader("foo", "1")
.setHeader("bar", "2")
@ -74,21 +73,21 @@ public class MessageBuilderTests {
}
@Test
public void testIdHeaderValueReadOnly() {
void idHeaderValueReadOnly() {
UUID id = UUID.randomUUID();
assertThatIllegalArgumentException().isThrownBy(() ->
MessageBuilder.withPayload("test").setHeader(MessageHeaders.ID, id));
}
@Test
public void testTimestampValueReadOnly() {
void timestampValueReadOnly() {
Long timestamp = 12345L;
assertThatIllegalArgumentException().isThrownBy(() ->
MessageBuilder.withPayload("test").setHeader(MessageHeaders.TIMESTAMP, timestamp).build());
}
@Test
public void copyHeadersIfAbsent() {
void copyHeadersIfAbsent() {
Message<String> message1 = MessageBuilder.withPayload("test1")
.setHeader("foo", "bar").build();
Message<String> message2 = MessageBuilder.withPayload("test2")
@ -100,7 +99,7 @@ public class MessageBuilderTests {
}
@Test
public void createFromMessage() {
void createFromMessage() {
Message<String> message1 = MessageBuilder.withPayload("test")
.setHeader("foo", "bar").build();
Message<String> message2 = MessageBuilder.fromMessage(message1).build();
@ -109,7 +108,7 @@ public class MessageBuilderTests {
}
@Test // gh-23417
public void createErrorMessageFromErrorMessage() {
void createErrorMessageFromErrorMessage() {
Message<String> source = MessageBuilder.withPayload("test").setHeader("foo", "bar").build();
RuntimeException ex = new RuntimeException();
ErrorMessage errorMessage1 = new ErrorMessage(ex, Collections.singletonMap("baz", "42"), source);
@ -122,7 +121,7 @@ public class MessageBuilderTests {
}
@Test
public void createIdRegenerated() {
void createIdRegenerated() {
Message<String> message1 = MessageBuilder.withPayload("test")
.setHeader("foo", "bar").build();
Message<String> message2 = MessageBuilder.fromMessage(message1).setHeader("another", 1).build();
@ -131,7 +130,7 @@ public class MessageBuilderTests {
}
@Test
public void testRemove() {
void remove() {
Message<Integer> message1 = MessageBuilder.withPayload(1)
.setHeader("foo", "bar").build();
Message<Integer> message2 = MessageBuilder.fromMessage(message1)
@ -141,7 +140,7 @@ public class MessageBuilderTests {
}
@Test
public void testSettingToNullRemoves() {
void settingToNullRemoves() {
Message<Integer> message1 = MessageBuilder.withPayload(1)
.setHeader("foo", "bar").build();
Message<Integer> message2 = MessageBuilder.fromMessage(message1)
@ -151,28 +150,28 @@ public class MessageBuilderTests {
}
@Test
public void testNotModifiedSameMessage() throws Exception {
void notModifiedSameMessage() throws Exception {
Message<?> original = MessageBuilder.withPayload("foo").build();
Message<?> result = MessageBuilder.fromMessage(original).build();
assertThat(result).isEqualTo(original);
}
@Test
public void testContainsHeaderNotModifiedSameMessage() throws Exception {
void containsHeaderNotModifiedSameMessage() throws Exception {
Message<?> original = MessageBuilder.withPayload("foo").setHeader("bar", 42).build();
Message<?> result = MessageBuilder.fromMessage(original).build();
assertThat(result).isEqualTo(original);
}
@Test
public void testSameHeaderValueAddedNotModifiedSameMessage() throws Exception {
void sameHeaderValueAddedNotModifiedSameMessage() throws Exception {
Message<?> original = MessageBuilder.withPayload("foo").setHeader("bar", 42).build();
Message<?> result = MessageBuilder.fromMessage(original).setHeader("bar", 42).build();
assertThat(result).isEqualTo(original);
}
@Test
public void testCopySameHeaderValuesNotModifiedSameMessage() throws Exception {
void copySameHeaderValuesNotModifiedSameMessage() throws Exception {
Date current = new Date();
Map<String, Object> originalHeaders = new HashMap<>();
originalHeaders.put("b", "xyz");
@ -187,7 +186,7 @@ public class MessageBuilderTests {
}
@Test
public void testBuildMessageWithMutableHeaders() {
void buildMessageWithMutableHeaders() {
MessageHeaderAccessor accessor = new MessageHeaderAccessor();
accessor.setLeaveMutable(true);
MessageHeaders headers = accessor.getMessageHeaders();
@ -199,7 +198,7 @@ public class MessageBuilderTests {
}
@Test
public void testBuildMessageWithDefaultMutability() {
void buildMessageWithDefaultMutability() {
MessageHeaderAccessor accessor = new MessageHeaderAccessor();
MessageHeaders headers = accessor.getMessageHeaders();
Message<?> message = MessageBuilder.createMessage("foo", headers);
@ -212,21 +211,16 @@ public class MessageBuilderTests {
}
@Test
public void testBuildMessageWithoutIdAndTimestamp() {
void buildMessageWithoutIdAndTimestamp() {
MessageHeaderAccessor headerAccessor = new MessageHeaderAccessor();
headerAccessor.setIdGenerator(new IdGenerator() {
@Override
public UUID generateId() {
return MessageHeaders.ID_VALUE_NONE;
}
});
headerAccessor.setIdGenerator(() -> MessageHeaders.ID_VALUE_NONE);
Message<?> message = MessageBuilder.createMessage("foo", headerAccessor.getMessageHeaders());
assertThat(message.getHeaders().getId()).isNull();
assertThat(message.getHeaders().getTimestamp()).isNull();
}
@Test
public void testBuildMultipleMessages() {
void buildMultipleMessages() {
MessageHeaderAccessor headerAccessor = new MessageHeaderAccessor();
MessageBuilder<?> messageBuilder = MessageBuilder.withPayload("payload").setHeaders(headerAccessor);
@ -243,4 +237,5 @@ public class MessageBuilderTests {
assertThat(message2.getHeaders().get("foo")).isEqualTo("bar2");
assertThat(message3.getHeaders().get("foo")).isEqualTo("bar3");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2020 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,6 +25,7 @@ import org.springframework.web.servlet.DispatcherServlet;
* @author Stephane Nicoll
* @since 4.3.4
*/
@FunctionalInterface
public interface DispatcherServletCustomizer {
/**