BeanFactory's new metadata cache

Hey Luis,

I noticed you added a variable into the bean factory to cache object
metadata (variables.autowireCache).

I was curious if you had planned to add a way for us to access that
cache so we could use it rather than relying on getMetaData().

Also, did you see a significant performance gain when it was added it



Hi Brett,

I added some functions to access it on it for now.

As for speed. I would hope to get some real life results from you guys

Great! Thanks.

Hey Luis,

I've noticed there has been some changes to the BeanFactory lately and
there is now a BeanFactoryCompat that looks to be the previous
component that you are depreciating for new autowire integration.

Is there a new function to access the metadata cache that I am not
seeing? Or should I just depend on getMetaData() until everything
settles with 3.0?



wirebox is complete brett. You can check it out now. I am writing the docs at the moment, but wirebox is complete.

Great to hear....

I may be getting ahead of myself, but I enabled wirebox in my config,
which turns off compatMode and I've been running into all sorts of
issues with the beanFactory.

Here is one -

The beanFactory.autowire() function defines a default for the
targetID. When compatMode is off the autowire arguments are passed
through to the Injector's autowire function which has a NOT
structKeyExists(arguments,"targetID") condition to determine if the
target identity needs to be resolved from the metadata or if it is
passed in through the autowire call. This throws an error when
calling autowire through the BeanFactory when you only specify the
target argument. i.e. beanFactory.autowire( myComponent );

Another one is there is no wirebox support for
BeanFactory.addModelMapping(). I'm guessing this should call the
binder to add the mapping but the conditional doesn't exist for
checking compatMode.

Should I continue plowing through these issues and report back? Or
should I stay in compatMode and wait for documentation to be
completed? The docs will probably answer a lot of my questions....

Speeking of which question from yesterday was how would I access
BeanFactory.getAutowireCache() with compatMode turned off.

Very cools stuff!


I will check the autowire without the I'd. As far as mappings go, the injector has each a configuration binder that holds all object mappings. You interface with the finder to add more, remove add scan locations, remove etc.

Also, each mapping represents everything about the object including metadada. So the metadata cache is now part of a mapping itself encapsulated. So all cache metadata is basically all the mappins. Does this make sense?

Yep makes sense. I'll check it out.




The injector has this on the autowire method:

if( NOT structKeyExists(arguments,"targetID") ){
  arguments.targetID = thisMap.getName();

which checks for the existence of the target id, so I don't see how it
can fail. Also my tests don't fail either.

It has to do with calling autowire() through the BeanFactory.

Since the BeanFactory has a default value of "" (empty string) for the
targetID argument and beanFactory.autowire() uses pass through
arguments for wirebox.autowire() the targetID argument in
wirebox.autowire() will be an empty string/ So structKeyExists()
check returns false and thisMap.getName() is never called and wirebox
will throw an error evaluting the empty target string.

Do you see it?

call beanFactory.autowire( myComponent ); and you will see the error.
You have to have wirebox turned on.


got it, thanks!
Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager: