RE: [coldbox:17620] [Coldbox-3.5.3] Model not showing up as expected when injected into plugin

Something else to consider is the scope of object receiving the injection. Your userService might be a singleton and the singleton “Scope” in WireBox gets cleared out when the framework reinits, but it is possible that the CFC you were injecting it into was a user object stored in session. You can reinit all day long and it will never clear out your session-scoped user object.

On another note, the name of the property does not need to match the name of the object at all.

The following is completely valid, and the object will be injected as variables.foobar
property name=“foobar” inject=“id:userService”;

It’s also worth mentioning that for simple model injections, you actually don’t need “id” or “model”. The following works too since the inject value is treated as a DSL which defaults to a mapping ID if no DSL namespace is matched:
property name=“userService” inject=“userService”;

Even better, is that the value of the inject attribute defaults to that of the name attribute, so the following is also the same as above:
property name=“userService” inject;

I prefer that last syntax because it is so clean and simple. Just keep in mind Railo currently doesn’t like that last syntax, but I have a ticket in to fix it



ColdBox Platform Evangelist
Ortus Solutions, Corp

ColdBox Platform: