Fork me on GitHub

Spring Framework Integration

Since version 5.5.0 Spring integration comes within additional module dozer-spring.

Add the DozerBeanMapperFactoryBean to your Spring configuration file. The mappingFiles property is where you should specify any custom dozer mapping files that you have created. This list can be empty if you don't have any custom mappings. It is also possible to set custom event listeners and bean factories.

Note that this Factory Bean supports Spring Resources, which means that you could load mapping Xml files by classpath mask for example.

    <bean class="org.dozer.spring.DozerBeanMapperFactoryBean">
        <property name="mappingFiles" 
        <property name="customConverters">
                <bean class=
        <property name="eventListeners">
                <bean class="org.dozer.listeners.EventListener"/>
        <property name="factories">
                <entry key="id" value-ref="bean-factory-ref"/>

IMPORTANT: You shoud define the Dozer mapper bean is defined as singleton="true". You should configure the Mapper instance(s) this way so that you do not have to reload and reinitialize the mapping files for each individual mapping during the lifecycle of your app. Reinitializing the mapping files for each mapping would be inefficent and unnecessary. The DozerBeanMapper class is thread safe.

If you want to avoid clashing of mapping definitions for different functionality it is possible to define own DozerBeanMapper instance for each such use case.

A simpler way of registering mapper instance is without wrapping factory bean.

<bean id="org.dozer.Mapper" class="org.dozer.DozerBeanMapper">
  <property name="mappingFiles">

Using Spring to retrieve the Dozer Mapper......

  Mapper mapper = yourSpringBeanFactory.getBean("mapperBeanName");
  DestinationObject destObject =, DestinationObject.class);