-
-
Save peter-y/852f1d42da931c9b5b5c60bd04fe3741 to your computer and use it in GitHub Desktop.
PropertyPlaceholderConfigurer 配置 加载 properties 文件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 写法1 --> | |
<bean id="mappings" | |
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> | |
<!-- typed as a java.util.Properties --> | |
<property name="properties"> | |
<value> | |
jdbc.driver.className=com.mysql.jdbc.Driver | |
jdbc.url=jdbc:mysql://localhost:3306/mydb | |
</value> | |
</property> | |
<property name="location"> | |
<value> | |
/*.properties | |
</value> | |
</property> | |
</bean> | |
<!-- 写法二 --> | |
<context:property-placeholder location="classpath:*.properties"/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment