【问题标题】:How to specify dozer.properties location?如何指定 dozer.properties 位置?
【发布时间】:2011-07-03 14:36:50
【问题描述】:

我正在使用带有 Spring 3.0.x 的推土机。这是我的映射器 bean 定义:

<bean id="mapper" class="org.dozer.DozerBeanMapper" lazy-init="true">
    <property name="mappingFiles">
        <list>
            <value>dozer-bean-mappings.xml</value>
        </list>
    </property>
</bean>

我想把 dozer.properties 文件放在 src/main/resources/conf/app/dozer.properties 中。

如何指定自定义 dozer.properties 位置?

【问题讨论】:

    标签: spring configuration dozer


    【解决方案1】:
    <bean id="org.dozer.Mapper" class="org.dozer.DozerBeanMapper">
      <property name="mappingFiles">
        <list>
          <value>dozer-global-configuration.xml</value>
          <value>dozer-bean-mappings.xml</value>
        </list>
      </property>
    </bean>
    

    确保您的 xml 文件位于类路径中

    http://dozer.sourceforge.net/documentation/springintegration.html

    【讨论】:

      【解决方案2】:

      the documentation中所述:

      另一个推土机属性文件 可以通过指定 dozer.configuration 系统属性。 前任) -Ddozer.configuration=someDozerConfigurationFile.properties

      所以只需使用-Ddozer.configuration=/conf/app/dozer.properties 启动您的应用

      【讨论】:

      • 是的,我阅读了文档的那部分,但我有很多平衡的服务器,所以我更愿意在 .war 中包含该配置
      猜你喜欢
      • 2013-08-16
      • 2012-04-09
      • 1970-01-01
      • 2010-11-07
      • 2017-04-18
      • 2013-05-18
      • 2014-02-19
      • 2022-01-05
      • 2012-03-10
      相关资源
      最近更新 更多