【问题标题】:How configure EncryptablePropertyPlaceholderConfigurer (jasypt) with environment variable如何使用环境变量配置 EncryptablePropertyPlaceholderConfigurer (jasypt)
【发布时间】:2020-07-20 14:25:40
【问题描述】:

我正在配置 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>

【问题讨论】:

  • 你能升级到 JSAPT 1.9 吗?

标签: spring environment-variables placeholder jasypt


【解决方案1】:

我找到了一个简单的解决方案!

我只需要输入这段代码,去掉列表标签,就可以正常工作了!

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

【讨论】:

    猜你喜欢
    • 2016-12-30
    • 1970-01-01
    • 2012-01-11
    • 2021-09-15
    • 2022-06-11
    • 1970-01-01
    • 2019-04-10
    • 2011-09-11
    • 2020-09-28
    相关资源
    最近更新 更多