d80tb7
Oct 20th, 2009, 02:56 AM
Hi,
we currently configure our application via a Spring XML context file and us a PropertyPlaceholderConfigurer so that external properties can be exposed. We now want to allow functionality sich that a variable number of sping beans can be set up via the properties file: For example:
We declare a Spring bean "foo" which takes a list of type "bar"
"bar" has two properties: property1 and property2.
In the properties file the user will enter something like:
bar.1.property1=a
bar.1.propperty2=b
bar.2.property1=c
bar.2.property2=d
...
bar.n.property1=x
bar.n.property2=y
This will cause spring to instantiate the "foo bean" with a list of n "bars" each with the properties given in the properties file.
Does anybody know if something like this is possible with the Spring framework as it stands at the moment? If not where would be the best place to start in order to add the functionality?
many thanks,
Chris
we currently configure our application via a Spring XML context file and us a PropertyPlaceholderConfigurer so that external properties can be exposed. We now want to allow functionality sich that a variable number of sping beans can be set up via the properties file: For example:
We declare a Spring bean "foo" which takes a list of type "bar"
"bar" has two properties: property1 and property2.
In the properties file the user will enter something like:
bar.1.property1=a
bar.1.propperty2=b
bar.2.property1=c
bar.2.property2=d
...
bar.n.property1=x
bar.n.property2=y
This will cause spring to instantiate the "foo bean" with a list of n "bars" each with the properties given in the properties file.
Does anybody know if something like this is possible with the Spring framework as it stands at the moment? If not where would be the best place to start in order to add the functionality?
many thanks,
Chris