簡體   English   中英

如何使用環境變量配置 EncryptablePropertyPlaceholderConfigurer (jasypt)

[英]How configure EncryptablePropertyPlaceholderConfigurer (jasypt) with environment variable

我正在配置 EncryptablePropertyPlaceholderConfigurer (JASYPT 1.8) 的 xml,它從 SPRING 擴展了 PropertyPlaceholderConfigurer,我需要放置一個環境變量而不是我的屬性文件的位置,如下所示,但不起作用。 任何人都知道我該如何配置它?

當我輸入文件的真實路徑時,一切正常。

 <bean 
   class="org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer">
        <constructor-arg ref="configurationEncryptor" />   
        <property name="systemPropertiesModeName"    value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
        <property name="searchSystemEnvironment" value="true" />
        <property name="ignoreResourceNotFound" value="true" />

         <property name="locations">
            <list>
                <value>file:///${PROP}/teste.properties</value>                  
             </list>
         </property>
    </bean>

我找到了一個簡單的解決方案!

我只需要把這個代碼,沒有列表標簽,並且工作正常!

<bean class="org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer">
    <constructor-arg ref="configurationEncryptor" />
    <property name="location">
        <value>file:///${PROP}/teste.properties</value>
    </property>
</bean>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM