-
Jun 29th, 2012, 08:13 AM
#1
Spring configuration
What is the best way to handle the following requirement using Spring configuration:
1) A property file contains a comma delimited String.
2) Define a prototype bean, let's call it FOO, which takes as a constructor a String.
3) Define a collection of FOO objects, constructing each one with one element from the comma delimited String.
4) Pass the collection of FOO objects to the constructor of BAR (a Singleton).
I would be interested if anyone could illustrate how this could be achieved both through XML configuration, and Annotations.
Thanks very much!
-
Jul 2nd, 2012, 02:03 AM
#2
Don't... Use a FactoryBean for the BAR object. When using java based configuration you could eliminate the FactoryBean and write it in a @Bean annotated method.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules