#3 Spring bean factory injection

closed
None
5
2005-11-16
2005-11-07
Rohan Hart
No

I've made some modifications to allow factories to be
injected via Spring (or similar). It's currently only
available via the DozerBeanMapper and assumes a 1-1
relationship between mapper and factory instance.
Unlike the existing factories, which are recreated each
time, the injected factory instance is reused though
it's possible that Spring might reset them if it felt
like it.

Non-injected factories are still available with their
current behaviour.

Here's how to use it...

<bean id="mapper"
class="net.sf.dozer.util.mapping.DozerBeanMapper"
singleton="true">
<property name="mappingFiles">
...
</property>
<property name="factories">
<map>
<!-- the key matches the name of the factory in the
dozerBeanMapping.xml file -->
<entry key="org.foo.DozerBeanFactory">
<ref bean="mapperBeanFactory"/>
</entry>
<!-- more factories can be supplied with
additional <entry>'s
</map>
</property>
</bean>

<bean id="mapperBeanFactory" class="org.foo.MyFactory"
singleton="true">
<property name="whatever">example required data
...
</bean>

Rohan

Discussion

  • Franz Garsombke

    Franz Garsombke - 2005-11-07

    Logged In: YES
    user_id=550744

    Thanks for the patch Rohan. Let me review this and we can
    get it in for the 1.5.7 release.

    Great work around the IOC stuff. Without 'real' world
    requirements it's hard to think of all possibilites. Nice Job.

    Franz

     
  • Franz Garsombke

    Franz Garsombke - 2005-11-07
    • assigned_to: nobody --> fgarsombke
     
  • Franz Garsombke

    Franz Garsombke - 2005-11-07
    • status: open --> pending
     
  • Franz Garsombke

    Franz Garsombke - 2005-11-16
    • status: pending --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks