Not sure how to explain my issue... 

My ColdSpring.xml file defines the PersonBean (basic getter/setter
bean). I have a PersonService.cfc that has a setPersonBean method. So CS
injects the PersonBean into the PersonService. In another method in the
PersonService, called 'getPerson', I want to create a new instance of
the PersonBean each time it is run.

How do I do this?

I thought setting singleton="true" on the PersonBean definition might do
it, but it doesn't. Probably because PersonService itself is a
singleton.

Okay, so I just tested this and I can set the PersonService to not be a
singleton, and I get what I want. But in my mind, the PersonService
should be a singleton, but the PersonBean should be created new each
time (I want a new instance as I am putting the PersonBean into an array
as they are created).

Maybe I'm going about it all wrong. I can also get it to work if I don't
use the injected bean, and simply do a createObject call in the
getPerson method.

But is there a better way? Thoughts?

Thanks, Matt Williams

Reply via email to