MESSAGE_FORMAT 与 {x.y}

MESSAGE_FORMAT with {x.y}

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

// 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);

我该怎么做?

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

@Message(value = "the user: {0} - {1}", format = Message.Format.MESSAGE_FORMAT)
void test(String id, String name);