代码之家  ›  专栏  ›  技术社区  ›  Jonas Byström

使用PropertyPlaceholderConfigurator时丢失${project.name}

  •  0
  • Jonas Byström  · 技术社区  · 10 年前

    我正在使用Maven构建一个Spring(3.0.5.RELEASE)项目。在applicationContext.xml中,我使用 PropertyPlaceholderConfigurer (从数据库加载财产)如下:

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="properties" ref="configurationConverter"/>
    </bean>
    

    我想在数据库中访问的财产工作正常,但 ${project.name} ${project.version} 停止工作。这些财产最初来自哪里?最重要的是:我怎样才能找回它们?

    1 回复  |  直到 10 年前
        1
  •  1
  •   Richard Neish    10 年前

    如果您使用Maven Resources插件并设置filtering=true,则可以替换Maven变量,如“project.version”。请参阅 https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html