在我的项目中,已使用 EncryptablePropertySourcesPlaceholderConfigurer,然后已为其父“PropertiesLoaderSupport”的“资源 [] 位置”属性分配了我要加载的每个属性文件。我想这就是我没有遇到任何错误的原因。
例如:
<bean id="frameworkPropertyPlaceholderConfigurer"
class="org.jasypt.spring31.properties.EncryptablePropertySourcesPlaceholderConfigurer">
<constructor-arg ref="stringEncryptor" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="locations">
<list>
<bean parent="frameworkConfigResourceFactoryBean">
<property name="resourceName" value="framework-config.properties" />
</bean>
<bean ................> </bean>
</list>
</property>
</bean>
在 database-config.properties 中:
database.driver.class=com.mysql.jdbc.Driver
database.connection.url=${database.connection.url}
database.username=root
database.password=${database.password}
同样在 filter.properties 中:
database.connection.url=jdbc:mysql://localhost:3306/MySQLDBName?rewriteBatchedStatements=true
database.password=root