Results 1 to 2 of 2

Thread: Spring configuration

  1. #1
    Join Date
    Jun 2012
    Posts
    3

    Question 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!

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •