简体   繁体   English

如何使用环境变量配置 EncryptablePropertyPlaceholderConfigurer (jasypt)

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

I'm configuring the xml of EncryptablePropertyPlaceholderConfigurer (JASYPT 1.8), that extends PropertyPlaceholderConfigurer from SPRING, and I need put a environment var instead of the location of my properties file as follow, but isnt working.我正在配置 EncryptablePropertyPlaceholderConfigurer (JASYPT 1.8) 的 xml,它从 SPRING 扩展了 PropertyPlaceholderConfigurer,我需要放置一个环境变量而不是我的属性文件的位置,如下所示,但不起作用。 Anyone knows something about how could I configure it?任何人都知道我该如何配置它?

Everthing is working fine when I put the real path of the file.当我输入文件的真实路径时,一切正常。

 <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>

I found a simple solution!我找到了一个简单的解决方案!

I just needed put this code, whitout the list tag, and works fine!我只需要把这个代码,没有列表标签,并且工作正常!

<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