|
@@ -44,11 +44,9 @@ |
|
|
import org.springframework.expression.Expression; |
|
|
import org.springframework.expression.TypedValue; |
|
|
import org.springframework.expression.spel.SpelEvaluationException; |
|
|
import org.springframework.expression.spel.SpelMessage; |
|
|
import org.springframework.expression.spel.SpelParserConfiguration; |
|
|
import org.springframework.expression.spel.standard.SpelExpressionParser; |
|
|
import org.springframework.expression.spel.support.StandardEvaluationContext; |
|
|
import org.springframework.expression.spel.support.StandardTypeConverter; |
|
|
import org.springframework.expression.spel.support.SimpleEvaluationContext; |
|
|
import org.springframework.lang.Nullable; |
|
|
import org.springframework.util.Assert; |
|
|
import org.springframework.web.bind.WebDataBinder; |
|
@@ -176,16 +174,6 @@ public void setPropertyValue(String propertyName, @Nullable Object value) throws |
|
|
throw new NotWritablePropertyException(type, propertyName); |
|
|
} |
|
|
|
|
|
StandardEvaluationContext context = new StandardEvaluationContext(); |
|
|
context.addPropertyAccessor(new PropertyTraversingMapAccessor(type, conversionService)); |
|
|
context.setTypeConverter(new StandardTypeConverter(conversionService)); |
|
|
context.setTypeLocator(typeName -> { |
|
|
throw new SpelEvaluationException(SpelMessage.TYPE_NOT_FOUND, typeName); |
|
|
}); |
|
|
context.setRootObject(map); |
|
|
|
|
|
Expression expression = PARSER.parseExpression(propertyName); |
|
|
|
|
|
PropertyPath leafProperty = getPropertyPath(propertyName).getLeafProperty(); |
|
|
TypeInformation<?> owningType = leafProperty.getOwningType(); |
|
|
TypeInformation<?> propertyType = leafProperty.getTypeInformation(); |
|
@@ -213,6 +201,14 @@ public void setPropertyValue(String propertyName, @Nullable Object value) throws |
|
|
value = conversionService.convert(value, TypeDescriptor.forObject(value), typeDescriptor); |
|
|
} |
|
|
|
|
|
EvaluationContext context = SimpleEvaluationContext // |
|
|
.forPropertyAccessors(new PropertyTraversingMapAccessor(type, conversionService)) // |
|
|
.withConversionService(conversionService) // |
|
|
.withRootObject(map) // |
|
|
.build(); |
|
|
|
|
|
Expression expression = PARSER.parseExpression(propertyName); |
|
|
|
|
|
try { |
|
|
expression.setValue(context, value); |
|
|
} catch (SpelEvaluationException o_O) { |
|
|