gpt4 book ai didi

java - messageSource 不会替换模板中的所有参数

转载 作者:行者123 更新时间:2023-12-04 22:00:54 25 4
gpt4 key购买 nike

我有代码:

messageSource.getMessage("some.key",new Object[]{30,31},Constants.LOCALE)

并在属性文件中键入:
some.key=Csv header length ({0}) doesn't correspond the mapping file size {1} .

但结果很奇怪:
Csv header length (30) doesn't correspond the mapping file size {1} .

第一个变量被成功替换,但第二个 - 没有。

为什么第二个参数没有解决?

最佳答案

问题是因为您在没有转义的消息中有一个单引号。

https://www.mscharhag.com/java/resource-bundle-single-quote-escaping以您的问题为例。

关于java - messageSource 不会替换模板中的所有参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47225104/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com