上次的博客,在xml文件中写死了数据库配置的参数,但是Spring不是这样做的。它是写在p roperties文件中,Spring再读取这些文件中的参数。
1. 开启context命名空间
2. 使用context空间加载propertise文件
Propertise文件内容:
加载propertise文件:(推荐写法)
<context:property-placeholder location="classpath:*.properties"/>
上次的博客,在xml文件中写死了数据库配置的参数,但是Spring不是这样做的。它是写在p roperties文件中,Spring再读取这些文件中的参数。
<context:property-placeholder location="classpath:*.properties"/>