getModel and caching

I was told by a coworker that getModel will always return the cached
object, so multiple calls to getmodel on a bean will just return a
pointer to the same bean. If so, how would you create multiple beans
and still use autowiring in the bean?

You can set the <cfcomponent.....cache="false"> to create singletons
from them. I'm assuming that you're wanting to inject other
singletons into them, like new empty beans. The autowiring can do
each thing it needs to, while keeping the outer object as a singleton
and use singletons or other cached objects for the injection.

- Will B.

Jim, will is right.

By default, getModel() will create, wire and return objects (Transient Factory). However, if you put persistence metadata on the cfcomponent then the object can be cached for you.

Ex: (3.0.0 notations)

So , I can say
<cfset car_1 = getModel("car.car_bean") />
<cfset car_2 = getModel("car.car_bean") />
and have two seperate cars assuming I set cache=false inside the