Merge branch '5.3.x'
This commit is contained in:
@@ -76,6 +76,21 @@ class SpelCompilerTests {
|
||||
assertThat(expression.getValue(context)).asInstanceOf(BOOLEAN).isTrue();
|
||||
}
|
||||
|
||||
@Test // gh-28043
|
||||
void changingRegisteredVariableTypeDoesNotResultInFailureInMixedMode() {
|
||||
SpelParserConfiguration config = new SpelParserConfiguration(SpelCompilerMode.MIXED, null);
|
||||
SpelExpressionParser parser = new SpelExpressionParser(config);
|
||||
Expression sharedExpression = parser.parseExpression("#bean.value");
|
||||
StandardEvaluationContext context = new StandardEvaluationContext();
|
||||
|
||||
Object[] beans = new Object[] {new Bean1(), new Bean2(), new Bean3(), new Bean4()};
|
||||
|
||||
IntStream.rangeClosed(1, 1_000_000).parallel().forEach(count -> {
|
||||
context.setVariable("bean", beans[count % 4]);
|
||||
assertThat(sharedExpression.getValue(context)).asString().startsWith("1");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
static class OrderedComponent implements Ordered {
|
||||
|
||||
@@ -121,4 +136,28 @@ class SpelCompilerTests {
|
||||
boolean hasSomeProperty();
|
||||
}
|
||||
|
||||
public static class Bean1 {
|
||||
public String getValue() {
|
||||
return "11";
|
||||
}
|
||||
}
|
||||
|
||||
public static class Bean2 {
|
||||
public Integer getValue() {
|
||||
return 111;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Bean3 {
|
||||
public Float getValue() {
|
||||
return 1.23f;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Bean4 {
|
||||
public Character getValue() {
|
||||
return '1';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user