我有我的 application.properties:
test.md5.params=something1,something4
在我的 java 类中,我得到了这个特定的值: 并且需要创建与属性文件中相同的字符串,例如
public String calculate(RequestClass request)
{
List<String> params= //I am getting the values from application.prop
**(above part id done)**
我的问题如下::
现在在我的参数列表中我有 [something1,something4]
所以我需要连接两个字符串值,如下所示:
String finalString=request.getsomething1()+request.getsomething4();
return finalString;
}
我的问题是如何动态执行此操作,并且在我的属性文件中,我可能会收到“n”个值。 注意:我需要编写代码以使我的类保持不变,如果将来我在属性文件中添加 10 个以上的值,我的最终字符串应该像
一样返回 String finalString=request.getsomething1()+request.getsomething4()+....all the values.;