Autowire on 3M6

It appears autowire on 3M6 no longer accepts the type attribute,
instead it must be inject.

Something like this no longer works.

<cfproperty type="coldbox:plugin:sessionstorage" name="oSession" />

Instead it needs to be

<cfproperty inject="coldbox:plugin:sessionstorage" name="oSession" />

Unfortunately the documentation still shows both styles. Will this be
a new required method or will both entries be supported?

I can look into this and apply the fix I am sure in the code but if it
is going to go with inject rather than type, can the reason be
explained as this causes another application wide code update.

  1. It’s definitely changed to “inject” moving forward

  2. I think you can set your own by having a setting “BeanFactory_dslMarker” with a value of “type”. Although that may change once wirebox is added in.

Personally, I’m holding off for probably a gold release (maybe release candidate) so I can deal with all of the changes needed at once. Still running M5 for now.

  • Gabriel

Yeah looking at the BeanFactory.cfc from 3M5 to 3M6 they no longer
look for "type" in the parseMetadata function. This does not seem
difficult to add back in, I would just like to know why it would be
changed rather than leaving as it was.

IIRC, it was changed to not hijack the “type” attribute of the cfproperty and to make it consistent between cfproperty and constructor injection. Take that with a grain of salt :slight_smile:

Also, I’d point out that it looks like wirebox is the last big framework being worked on for a final 3.0. As wirebox deals with the dependency injection, anything you personally add in may break once that’s finalized and in place.

  • Gabriel

Type will no longer be supported as it conflicts with the actual cf
datatype. The new convention is to use the standardized annotation