【问题标题】:Play framework 2.3 Spring configuration file classpath issuePlay framework 2.3 Spring配置文件classpath问题
【发布时间】:2015-04-02 21:04:43
【问题描述】:

我正在使用 Play framework 2.3 我有一个外部 Play 插件,它使用 spring 与使用 Spring-Ldap 的 LDAP 服务器通信。

目前我将配置文件放在 /conf 文件夹中,名为 ldap.properties。

在开发者模式下这很好用。 Spring 像这样加载它自己的上下文 ->

<context-source
        url="${ldap.bind.url}"
        base="${ldap.bind.base}"
        username="${ldap.bind.username}"
        password="${ldap.bind.password}" />

<bean id="placeholderConfig"     class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <value>classpath:ldap.properties</value>
        </list>
    </property>
    <property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>

如您所知,我正在使用类路径中的 ldap.properties。

当我创建一个播放分发时,ldap.properties 文件被复制到主项目的 jar 文件中。

我需要将哪些参数传递给 Play 以忽略 JAR 中的 ldap.properties 文件并使用给定位置的实时服务器使用的参数?

【问题讨论】:

    标签: playframework-2.0 playframework-2.3


    【解决方案1】:

    您可以将 Spring 设置为从指定的位置 via an environment variable at runtime 读取属性。这样,您的本地属性文件将提供默认设置,而服务器上的属性文件将覆盖它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-28
      • 2015-05-13
      • 1970-01-01
      • 2020-07-07
      • 2014-11-14
      • 2015-12-09
      • 1970-01-01
      • 2015-04-25
      相关资源
      最近更新 更多