RE: [coldbox:9644] Wirebox and autowiring: not working for me

“model” is the default scan location, but scan locations are not recursive. If you have beans in a sub directory, you will need to add that as a scan location or do the map().to() specifically for each of them.

Alternatively, you can use the mapDirectory(“model”) method in your wirebox.cfc config file to have it recursively map everything in your model directory. You might need to do that first though so your specific mappings for your services override that.

None-the-less, it appears that whatever you have configured is working to some extent since you are apparently creating instances of your beans. You’re asking WireBox for the beans right? (As opposed to directly creating them via createObject().

Enable debug logging for coldbox.system and check your logs for warnings about whether or not the datasource called “dsn” was found.

Also, you’re looking in the variables scope of your bean for the myDSN variable, right?

Thanks!

~Brad

I added the model.beans location to the Scanlocations property in the
wirebox.cfc, but that did not make a difference. The beans I am
talking about are ORM beans, and I call them in my service layer by a
getEntity(). In the Simpleblog example, I saw that the service layer
extended the VirtualEntity service, but I am not using that. Should I?

Kind regards,

Erik-Jan

Hi Brad,

Eureka! Seems like I was dealing with some very persistent caching,
because after a restart of Railo, it started to work. It looks like
all I had to do was add the path to the beans to the ScanLocations
property.

Thanks for the help!

Erik-Jan