1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Ticket #91 (closed defect: fixed)

Opened 16 months ago

Last modified 11 months ago

factory-bean not looked for in parent factory

Reported by: d1rtym0nk3y Owned by: markmandel
Priority: major Milestone: Alpha2
Component: Beans Version: 2.0
Keywords: factory, bean, parent Cc:

Description

I have an application factory set as parent for an internal factory for modelglue. in the modelglue config bean i'm referencing a factory bean in the parent factory like this..

<bean id="modelglue.modelGlueConfiguration" class="ModelGlue.gesture.configuration.ModelGlueConfiguration">
  <property name="reload">
    <bean factory-bean="AppConfig" factory-method="getReloadEveryRequest" />
  </property>
<!-- all the other usual properties here -->
</bean>

This generates the error "The Bean Definition 'AppConfig?' does not exist in this factory". True, but it does exist in the parent factory and this worked in CS1.2

If I import the xml file containing the AppConfig? bean then this works fine

Change History

Changed 16 months ago by markmandel

  • owner set to markmandel
  • status changed from new to accepted
  • version changed from BER to 2.0

Ah yep - I see it.
https://github.com/markmandel/coldspring/blob/develop/coldspring/beans/support/CFCBeanDefinition.cfc#L272

Should be a call to 'getBeanDefinitionIncludingAncestor' on the BeanDefinitionRegistry?.

Will write up a unit test to confirm.

Changed 15 months ago by d1rtym0nk3y

Mark,

I've patched this in my fork but it doesn't seem to have fixed the problem. Its affecting factory beans and autowiring of beans from a parent factory in a child.

As a work around i'm <import>ing the beans into the child factory but this isn't an ideal solution

https://github.com/d1rtym0nk3y/coldspring/commit/5909d74c26272ce454720632e7039a65031089d5

Changed 15 months ago by markmandel

Hey - I haven't forgotten about you - just been crazy busy with stuff.

I'll be sure to jump on this asap.

Changed 11 months ago by markmandel

  • status changed from accepted to closed
  • resolution set to fixed

Finally got back to this.

I pushed up a commit that should fix this. I had a quick review of the autowire to code, to see if I could see an issue with autowiring and parent bean factories, and couldn't see anything.

https://github.com/markmandel/coldspring/commit/47201a01dacea95b39e8f71ad8884b735d908c4d

I'll close this ticket for this particular issue, but please open new tickets for any issues you find with parent factories moving forward.

Note: See TracTickets for help on using tickets.