Skip to content

Commit 6f08c0b

Browse files
committed
Merge branch '7.0.x'
2 parents d37d7ab + f3b6c22 commit 6f08c0b

4 files changed

Lines changed: 29 additions & 3 deletions

File tree

framework-docs/modules/ROOT/pages/core/expressions/language-ref.adoc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,12 @@
22
= Language Reference
33
:page-section-summary-toc: 1
44

5-
This section describes how the Spring Expression Language works.
5+
Spring Expression Language (SpEL) expressions are composed of a sequence of tokens such
6+
as literals, operators, method invocations, and so forth.
7+
8+
Whitespace can be used freely between tokens to format and improve the readability of
9+
expressions. Specifically, the `\s` (space), `\t` (tab), `\r` (carriage return), and `\n`
10+
(newline) characters are all valid separators between tokens. However, whitespace is
11+
ignored by the expression parser unless it is part of a string literal.
12+
13+
The following sections describe the features and syntax of SpEL.

framework-docs/modules/ROOT/pages/core/expressions/language-ref/literal.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
= Literal Expressions
33

44
SpEL supports the following types of literal expressions.
5-
The `\s`, `\t`, `\r` and `\n` characters are all valid separators between tokens.
65

76
String ::
87
Strings can be delimited by single quotation marks (`'`) or double quotation marks

spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ private boolean isFiltered(String attributeName) {
604604
return clazz.getClassLoader();
605605
}
606606
if (this.source instanceof Member member) {
607-
member.getDeclaringClass().getClassLoader();
607+
return member.getDeclaringClass().getClassLoader();
608608
}
609609
}
610610
return null;

spring-core/src/test/java/org/springframework/core/annotation/TypeMappedAnnotationTests.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.lang.annotation.Annotation;
2121
import java.lang.annotation.Retention;
2222
import java.lang.annotation.RetentionPolicy;
23+
import java.lang.reflect.Method;
2324
import java.util.Collections;
2425
import java.util.HashMap;
2526
import java.util.Map;
@@ -28,6 +29,7 @@
2829
import org.junit.jupiter.api.Nested;
2930
import org.junit.jupiter.api.Test;
3031

32+
import org.springframework.core.OverridingClassLoader;
3133
import org.springframework.core.annotation.MergedAnnotation.Adapt;
3234

3335
import static org.assertj.core.api.Assertions.assertThat;
@@ -125,6 +127,23 @@ void adaptFromStringToClass() {
125127
assertThat(annotation.getClass("classValue")).isEqualTo(InputStream.class);
126128
}
127129

130+
@Test // gh-36606
131+
void adaptFromStringToClassWithMemberSourceUsesMemberClassLoader() throws Exception {
132+
OverridingClassLoader classLoader = new OverridingClassLoader(getClass().getClassLoader()) {
133+
@Override
134+
protected boolean isEligibleForOverriding(String className) {
135+
return ClassAttributes.class.getName().equals(className);
136+
}
137+
};
138+
Class<?> sourceClass = classLoader.loadClass(ClassAttributes.class.getName());
139+
Method sourceMethod = sourceClass.getDeclaredMethod("classValue");
140+
141+
MergedAnnotation<?> annotation = TypeMappedAnnotation.of(null, sourceMethod,
142+
ClassAttributes.class, Map.of("classValue", sourceClass.getName()));
143+
144+
assertThat(annotation.getClass("classValue").getClassLoader()).isSameAs(classLoader);
145+
}
146+
128147
@Test
129148
void adaptFromStringArrayToClassArray() {
130149
MergedAnnotation<?> annotation = TypeMappedAnnotation.of(null, null, ClassAttributes.class,

0 commit comments

Comments
 (0)