GH-3104 Add JsonGetter to show SpEL expression as String
This is specifically done for actuator binding endpoint to avoid type conversion Resolves #3104
This commit is contained in:
@@ -23,6 +23,9 @@ import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import org.springframework.expression.Expression;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* Extended producer properties for Kafka binder.
|
||||
*
|
||||
@@ -187,6 +190,14 @@ public class KafkaProducerProperties {
|
||||
public Expression getMessageKeyExpression() {
|
||||
return this.messageKeyExpression;
|
||||
}
|
||||
|
||||
@JsonGetter("messageKeyExpression")
|
||||
public String getTheMessageKeyExpression() {
|
||||
if (this.messageKeyExpression != null) {
|
||||
return this.messageKeyExpression.getExpressionString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setMessageKeyExpression(Expression messageKeyExpression) {
|
||||
this.messageKeyExpression = messageKeyExpression;
|
||||
|
||||
Reference in New Issue
Block a user