Hi. I am having some trouble trying to implement autowiring and hoped
someone could help.
I have a abstractHandler which all my other handlers will inherit from
and within this handler I have two properties.
component autowire="true" {
property name="someObject" inject="model:myObject";
property name="mySecondObject" inject="model";
public abstractHandler function init() {
return this;
}
}
With my models defined:
component displayname="myObject" accessors="true" singleton {
property name="someSetting" type="string"
inject="coldbox:setting:someSetting";
...
<cfcomponent displayname="mySecondObject" accessors="true" singleton>
...
Now from my understanding of autowiring, that should work. However I
get the error:
Error autowiring handlers.Main. The DSL Definition
{JAVACAST={null},NAME={someObject},DSL={model:myObject},REQUIRED={false},SCOPE={variables},VALUE={null},REF={null}}
did not produce any resulting dependency The target requesting the
dependency is: 'handlers.Main'
It seems the injection in my models is fine because if I remove the
properties in the abstractHandler and in the init function add:
someObject = application.wirebox.getInstance("models.myObject");
mySecondObject =
application.wirebox.getInstance("models.mySecondObject");
everything works fine. My Wirebox.cfc is the same as when I downloaded
and my config is defined:
wireBox = {
enabled = true,
singletonReload = true
};
interceptors = [
{class="coldbox.system.interceptors.Autowire",
properties={ debugMode=true }}
];
Does anyone have any ideas as to what I am doing wrong here?