播放框架2.3 Spring配置文件类路径问题

时间:2015-02-03 15:36:14

标签: playframework-2.0 playframework-2.3

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

目前我将配置文件放入/ conf fodlder调用 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文件并使用适用于给定位置的实时服务器的文件?

我会感激任何指示。

先谢谢,

1 个答案:

答案 0 :(得分:0)

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