[CB-5.4.1] Inject libraries into non-ORM object

How do I inject libraries into a non-ORM object?

This is how I instantiate the obj:

obj1 = wirebox.getInstance(“Class1”);

In Wirebox.cfc I have:


In Class1.cfc I have:

but when I try to use lib1 in any of the methods in Class1 I get:
Element LIB1 is undefined in a Java object of type class…


I cannot see anything immediately wrong with the way you doing it. I quick spun a server to test it and all works fine. See code below.

component singleton {
function foo(){
return “bar”;

component {
property name=“lib1” inject=“Lib1”;

function myMethod(){
return lib1.foo();

component extends=“coldbox.system.EventHandler”{
// Default Action
function index(event,rc,prc){
obj1 = wirebox.getInstance(“Class1”);
return obj1.myMethod();

//…other handlers and actions


As a side note, if you add the ‘singleton’ attribute to the component declaration (such as a bove) wirebox will automagically instantiate the object as a singleton ! :slight_smile:

Thanks for your help.

Turns out the path for the scanLocations wasn’t correct. I forgot to add the base folder (my site is under a subfolder).