Suggestion: Have ColdBox Automatically injected into Beans created by LightWire or CS

LightWire injects itself into the beans it instantiates. It seems that
it could also inject ColdBox into every bean as well. CS probably has
the same abilities. This would make CB available nearly everywhere.

A good use for this would be to use the messagebox plugin or
queryhelper plugin in a server layer.

are you suggesting to create a convention, where if Lightwire detects a method signature of “setColdBox” or a cfproperty of ColdBox, to inject the controller?

Luis

Actually, I'm suggesting that LightWire automatically inject the CB
controller without a method signature or CFProperty. I wouldn't
recommend that people access the CB controller in their business
objects, DAOs or Gateways but definitely in their Services/Factories.

I think that injecting without permission seems wrong :).

I might consider if a coldbox property is declared, then by convention inject it, just how coldspring injects itself.

On second thought I'm not so sure that have the controller in the
service layer is the best idea. At least I've refactored mine so that
it is not dependent on the controller :slight_smile: