I'm trying to create and populate a guava HashBasedTable
in spring xml config file but I haven't been able to.
My table looks like this:
Table<String, Foo, Bar> myTable;
And I've tried this in my xml but don't know how put new value into the table:
<property name="myTable">
<bean class="com.google.common.collect.HashBasedTable" factory-method="create">
<!--- how do I insert value in here??? -->
</bean>
</property>
If you have not to use exclusively xml, you can use some Java to make your configuration a little more readable.
You can create an Utility method:
And add this to your configuration
Resulting in this table:
If you want to do this exclusively in xml, it's a bit tricky: I see guava doesn't offer too many options for putting values in that Table. There is an approach, but it's weird for more than one insert: