Configuring two instances of Transfer and how to call

Hi again,

I'm needing to setup 2 Transfer ORM Factories - 2 Datasources are
being put in place so I'm guessing I'm needing two instances of the
loader put in my Configuration?

I've seen a few ppl talking about this on the group but not
specifically CB3.0 config. To be honest after a few hours of trying to
do this I'm struggling a bit. Mainly with syntax and working examples
of how the configuration would be setup for doing this. Does anyone
have any pointers / examples of how the interceptor would be setup to
do this? Any help appreciated.

Ok I think I've got Lightwire now populating the services for me
through this ...

<?xml version="1.0" encoding="UTF-8"?>
  <!-- Coldbox -->
  <bean id="ColdboxFactory" class="coldbox.system.ioc.ColdboxFactory" /

  <bean id="Coldbox" factory-bean="ColdBoxFactory" factory-
method="getColdbox" />
  <bean id="ColdboxOCM" factory-bean="ColdBoxFactory" factory-
method="getColdBoxOCM" />

  <!-- Transfer -->
  <bean id="Transfer" factory-bean="ColdBoxOCM" factory-method="get">
    <constructor-arg name="objectKey"><value>Transfer</value></

  <!-- Login -->
  <bean id="LoginService" class="model.login.LoginService"
    <constructor-arg name="Coldbox">
      <ref bean="Coldbox" />
    <constructor-arg name="Transfer">
      <ref bean="Transfer" />
  <!-- /END - Login -->

That's only a single instance of Transfer but does that look about

Is there a way that I can call ColdBoxORM through the ColdBox bean
instead of having to declare it separately?

And finally am I right in assuming that I would use ColdBoxORM to call
my different instances of Transfer once I get them up and running? How
would I do that?

So many questions :slight_smile:


Some of what you're doing here I'm not familiar with, but if each
service needs one or the other Transfer instance, maybe the cleanest
approach would be two next-base classes that extend your existing
base, with each one having the appropriate Transfer instance injected
into it. Essentially you have to "classes" of server, one with each
Transfer config.

If it's more dynamic than that, then your getTransfer method needs to
be more active than just retrieving a single injected item.

Make sense?


Thanks for the input Dave, appreciate it :slight_smile:

It kind of makes sense but the two base extensions would be exactly
the same apart from calling the CB config for the different Transfer

They'd basically contain a getColdBox() and getTransfer() method....
with the getTransfer() pulling in the custom details through
getColdBox(). Gut instinct is telling me that's not very reusable.

The Lightwire approach I'm trying to do is by telling it which
Transfer instance needs to be injected into which service when they're
called. The likelihood is we're not going to have a service needing
both Transfer instances so this should work ( He says :slight_smile: ).

I just can't get my head around the syntax.

Thanks again,

Dave, look at the transfer loader interceptor, you can declare more than 1 with all the information you need for each factory, very easy to do.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager:

Hi Luis,

I have this at the moment, but how would I define another Transfer
Interceptor next to this one and how would I then call each one if /
when I need it?

interceptors = [
                 configPath = "/config/transfer.enrolment.xml.cfm",
            definitionPath = "/config/definitions/",
            datasourceAlias = "enrolNow",
            loadBeanInjector = true,
            beanInjectorProperties = {
              useSetterInjection = false

I guess I need some kind of id or name attribute for each?


Yes, each interceptor can take in a “name” attribute, so you will have to name them differently. Also, the most important part is that you setup the cache keys for each interceptor property. Read the docs, it tells you the keys for the 3 saved entries in cache, transfer, transferFactory and transferTransaction. Each interceptor must name each key differently so they don’t collide.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager:

Just to close off this one, in case anyone else searches for it,
here's what I've now got in place and working :-