0

如何在消息格式中添加属性的字符串值(来自用户实例)?

// I want to access a property from the user and put it into the message
@Message(value = "the user: {user.id} - {user.name}", format = Message.Format.MESSAGE_FORMAT)
void test(User user);

我怎样才能做到这一点?

4

1 回答 1

1

目前不支持这样的表达式。您需要手动执行以下操作:

@Message(value = "the user: {0} - {1}", format = Message.Format.MESSAGE_FORMAT)
void test(String id, String name);
于 2021-03-01T19:22:34.817 回答