Results 1 to 6 of 6

Thread: Initialize collection object (not for property injection)

  1. #1

    Default Initialize collection object (not for property injection)

    Hi All
    I am using Spring for some time now and I guess I am missing something
    I am trying to create collection with default values. I know collection are not "true" beans as they do not have the set and get methods. I also know that I can create a collection with their constractor but that seems not clean for me as spring will have to create the collection pass it to the constractor and then the collection object will have to run over the items and recreat the collection.

    In short is there a way to create a collection (or map for this matter) with default values?

    Thanks in advance
    Nehemia
    mmmm, I think I will order a cup of coffee in this beautiful spring day

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I'm not sure what you are trying to do. You want to create Collection and pass it into the beans constructor but you don't want to inject it in? Where is this Collection supposed to come from if you don't inject it?

  3. #3

    Default More info

    Hi karldmoore
    I want to create a collection as bean
    lets say ArrayList and add values to it
    The same goes with hashMap and so on
    Thanks for the reply
    Nehemia
    Last edited by litterat; May 6th, 2007 at 08:57 AM.
    mmmm, I think I will order a cup of coffee in this beautiful spring day

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

  5. #5

    Thumbs up Excelent

    This is what I was looking for
    thanks you very much
    mmmm, I think I will order a cup of coffee in this beautiful spring day

  6. #6
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Not a problem, glad the information was useful. The reference manual is full of lots of useful information, it's always worth having a thumb through it.

Posting Permissions

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