1.  用法:

从配置properties文件中读取init.password 的值。

  @Value("${init.password}")
private String initPwd;

2. 在spring的配置文件中加载配置文件dbconfig.properties :

  <!-- 加载配置文件 -->
<bean id="configProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="fileEncoding" value="UTF-8"/>
<property name="locations">
<list>
<value>classpath:dbconfig.properties</value>
</list>
</property>
</bean>

或者这样加载:

    <context:property-placeholder location="classpath:dbconfig.properties" />

或者这样加载:

    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
<property name="location">
<value>dbconfig.properties</value>
</property>
</bean>

3. dbconfig.properties  文件:

#MD5
password.algorithmName=md5
password.hashIterations=2
#initpwd
init.password=admin

最新文章

  1. python学习之day4,函数
  2. Visual Studio 2012 常用快捷键
  3. 问:Linux下Chrome标题栏中文乱码
  4. Git 基础应用
  5. POJ -3190 Stall Reservations (贪心+优先队列)
  6. const 的全面总结
  7. 关于java环境配置的问题
  8. JAVA学习-JAVA环境准备
  9. java socket报文通信(一)socket的建立
  10. js中几个容易混淆的概念
  11. Asp.Net MVC3 简单入门第一季(三)详解Controller之Filter
  12. SAE上使用本地sql文件建表时出错解决方法
  13. hdu2534-Score
  14. a标签点击之后有个虚线边框,怎么去掉
  15. Redis 2种持久化模式的缺陷
  16. Python中的可视化神器:pyecharts
  17. django rest framework批量上传图片及导入字段
  18. 十九、Linux 进程与信号---环境表
  19. 【linux轻松学】centos6.5上搭建svn服务器
  20. golang map输出排序

热门文章

  1. VMware虚拟机 + ubuntu16.04 Linux OpenCV打不开摄像头解决办法
  2. Vulnhub靶机渗透 -- DC5
  3. redis 主从复制详解
  4. VUE006. 前端跨域代理服务器ProxyTable概述与配置
  5. Weblogic漏洞分析之JNDI注入-CVE-2020-14645
  6. xxl-job &lt;=2.0.2 反序列化漏洞
  7. Ubuntu中类似QQ截图的截图工具并实现鼠标右键菜单截图
  8. Apache设置禁止访问网站目录
  9. Jmeter系列(15)- 常用断言之大小断言
  10. markdown写作系统