Java 如何在具有相同属性集的两个bean之间进行选择
如何更改代码在XML文件中查看的Bean。它们具有相同的属性集和类,但值不同Java 如何在具有相同属性集的两个bean之间进行选择,java,Java,如何更改代码在XML文件中查看的Bean。它们具有相同的属性集和类,但值不同 <bean id = "Test1" class = "Common.TestBuild"> <property name="testName" value = "x"/> <property name="columnNumberA" value = "x"/> <property name="columnNumberB" value = "x"/>
<bean id = "Test1" class = "Common.TestBuild">
<property name="testName" value = "x"/>
<property name="columnNumberA" value = "x"/>
<property name="columnNumberB" value = "x"/>
<property name="typeA" value = "x"/>
<property name="typeB" value = "x"/>
<property name="checkA" value = "x"/>
<property name="checkB" value = "x"/>
<property name="responceColunm" value = "x"/>
<property name="responceValue" value = "x"/>
</bean>
<bean id = "Test2" class = "Common.TestBuild">
<property name="testName" value = "b"/>
<property name="columnNumberA" value = "b"/>
<property name="columnNumberB" value = "b"/>
<property name="typeA" value = "b"/>
<property name="typeB" value = "b"/>
<property name="checkA" value = "b"/>
<property name="checkB" value = "b"/>
<property name="responceColunm" value = "b"/>
<property name="responceValue" value = "b"/>
</bean>
我正在代码中构建一个测试列表字符串数组来完成这项工作
public String[][] GetTestList(int ColumnCount, int TestCount)
{
String TestList[][] = new String[TestCount][9];
for (int i = 0; i < TestCount ; i++)
{
// code goes here for getter and setter calls but need to
// figure out how to change beans.
TestList[i][0] = TestName;
TestList[i][1] = ColumnNumberA;
TestList[i][2] = ColumnNumberB;
TestList[i][3] = typeA;
TestList[i][4] = typeB;
TestList[i][5] = CheckA;
TestList[i][6] = CheckB;
TestList[i][5] = ResponceColunm;
TestList[i][6] = ResponceValue;
}
return TestList;
}
public String[]GetTestList(int-ColumnCount,int-TestCount)
{
字符串TestList[][]=新字符串[TestCount][9];
对于(int i=0;i
我有Getter和Setter调用,但不确定如何更改要查看的Bean。每个congif文件中都有不同数量的测试bean。您可以根据
id属性来决定。您使用哪个库来解析XML?我使用的是Spring Framework 4.3.4。我已经查看了注释,但是@Qualifier不能进入for语句。我需要将它转换为Test1、Test2、Test3。。。。。。。TestN。为了基于BeansI中的值运行每个测试集,我使用lazy init=“true”进行调用,我只使用For语句对它们进行迭代。谢谢。您可以根据id属性
来决定。您使用哪个库来解析XML?我使用的是Spring Framework 4.3.4。我已经查看了注释,但是@Qualifier不能进入for语句。我需要将它转换为Test1、Test2、Test3。。。。。。。TestN。为了基于BeansI中的值运行每个测试集,我使用lazy init=“true”进行调用,我只使用For语句对它们进行迭代。非常感谢。