Wirebox scan locations vs binder mappings

Luis, I noticed in the WireBox docs you mentioned in a couple of places that using the binder mapping DSL is recommend over just relying on scan locations. i.e. map(“foo”).to(“com.bar.foo”)

I must say after playing with WireBox’s new scan locations and mapDirectory() functionality I’ve sort of fallen in love with the idea of WireBox just figuring out where my models are. The Aliases I have can be taken care of with the new component “alias” metadata along with the caching metadata and I kind of like that information configured in the actual component itself anyway. I must say I never look at my current modelMappings.cfm config file right now unless I need to add a new CFC, so I don’t get any personal documentation benefit from the config all being in one place.

It seems that refactoring won’t be any harder either since if I move a CFC from one directory to another, WireBox will still find it, and if I rename it, I can still just add an alias to it to continue requesting it by the old name. The only drawback I can really think of is if I have multiple CFCs in different directories with the same name, but I don’t have that in my app.

So basically, I say all that to ask this: Is there any other reason why setting up the binder mappings for every object is “preferred”. I’m about to “get jiggy” with the recursive directory mappings, but just want to make sure I’m not missing anything.

Thanks!

~Brad

Hi Brad,

I also tend to go the way of just using mapDirectory() now a days as I love that feature of using annotations and auto discovery. However, there are certain cases where you need specific mapping declarations:

  • To create different wirings for the same object, different dpeendencies, storages, etc. This cannot be accomplished with annotations alone.
  • To bring in legacy code
  • To create wrappers to legacy code
  • To create NON CFC objects. In WireBox you can create: java, rss, constant values, webservices, etc.
    Does this help you clarify things

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

That makes perfect sense. Thanks!

~Brad