I am trying to understand how the Autowire Interceptor works before I move on to wirebox. I have the following setup on in my project


In my security event handler I have

component {

// Dependencies
property name=“securityService” type=“model:security.SecurityService”;

The docs say for the autowire interceptor has a list of dependencies dsl. The problem is when I use the code above I get the following error.

Application Execution ExceptionError Type: Expression : [N/A]

Error Messages: Variable SECURITYSERVICE is undefined.

3.0 changed the syntax so the “type” attribute is not hijacked. Change your code as follows:

property name=“securityService” type=“model:security.SecurityService”;

property name=“securityService” inject=“model:security.SecurityService”;

Also, be sure to use the new docs. I noticed the link you provided is to the archived 2.x documentation.

The new hotness:
Old and busted:

So that makes a little more sense, one of the issues I have been having is examples/docs/other peoples code using different syntax but now I see why. Thanks Aaron!

I think I just found that from a search, thanks!

So I got everything working, thanks for pointing me in the right direction. My next question that kind of goes with this is…

If all I want to do is autowire dependencies that are in my model then there is no need for an ioc(coldspring/lightwire/wirebox) correct? If I start writing custom components or some other code that I will want to use an ioc to wire the dependencies for me. If not what are the advantages of using a framework if thats all I am doing? I know that most of the time I am going to need one but I am just trying to get a grasp on everything here.

Can you please elaborate? “…dependencies that are in my model…”

Do you mean in your model layer, or, a specific object?

I just meant my /model folder

I am used to having to manage all of my dependencies in ColdSpring where it looks like the bean factory can load my /model/.* into any of my handlers by using the dsl.

So the framework is doing some of the lifting for me already

Yes, you do not need to use any dependency management if you are creating objects that themselves do not require objects from outside your /model folder. Your /model folder is your domain. You are responsible for how it behaves.

However, I would recommend you instantiate your singletons with ColdBox’s DI (now called WireBox). The day will come when you will may want to inject something as simple as a setting into the model to control its behavior and you will be glad your handlers/interceptors created your service/DAO using the framework.

A real world example is a /model/SearchService.cfc I just wrote for a project. The SolrSearchService is autowired into the /handlers/Search.cfc which allows ColdBox to inject settings such as “Environment” into the model. However, the /model/SearchService.cfc creates a new SolrGateway.cfc in a OnDIComplete() method (which is executed by ColdBox once all dependencies are injected). When this SolrGateway is created I simply use the new operator: SolrGateway = new model.SolrGateway({…});.

Also, when I have transient objects (like those that represent a User) I do not use any dependency injection to ensure things are as fast as possible.

Does that help?

Makes total sense, the autowire feature of the framework simply wires components into other components… It’s not truly a dependency injection framework. right?

Thank You
Dan Vega

So I rewrote my security example…

bean definitions

<?xml version="1.0" encoding="utf-8"?>

Security Event Handler

component {

property name=“securityService” inject=“ioc”;


Security Service

component accessors=“true” {

property name=“userService”;

public SecurityService function init(){
return this;


This seems to work fine, but what about getting plugins into my security service, do I just call getPlugin() ?

nm…answered my own question :wink:

I would say WireBox is a Dependency Injection Framework. It can inject all sorts of things into your objects–not just CFCs.

Luis may have added even more to WireBox. I have not checked it out yet.


It is a DI framework, but it is abstracted in such a way that it doesn’t feel like one to help you get down to business faster via annotations. Internally, ColdBox always uses WireBox to do all that DI for your handlers, models, etc.

If you want to create a configuration file to declare your object dependencies etc, you can, that is your choice.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager: