Spring 中注入 properties 中的值
2024-10-09 16:57:31
<bean id="ckcPlaceholderProperties" class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:default.properties</value>
</list>
</property>
<property name="order" value="2"></property>
<property name="ignoreUnresolvablePlaceholders" value="true" />
</bean>
<bean id="pathConfig" class="com.movitech.erms.business.configuration.PathConfig"/>
# default.properties file content
local.attachment.path=1
attachment.resume.path=2
interview.attachment.path=D:\My Document
/**
* PathConfig 注入的类文件
*
* @author Tony.Wang
* @time 2014/4/28 0028 17:31
*/
public class PathConfig { @Value("${local.attachment.path}")
private String localAttachmentPath; @Value("${attachment.resume.path}")
private String attachmentResumePath; @Value("${interview.attachment.path}")
private String interviewAttachmentPath; public String getLocalAttachmentPath() {
return localAttachmentPath;
} public String getInterviewAttachmentPath() {
return interviewAttachmentPath;
} public String getAttachmentResumePath() {
return attachmentResumePath;
}
}
@Resource
private PathConfig pathConfig;
最新文章
- DOM动画效果的基础入门2
- WebForm增删改查
- soapUI请求参数Style与Level使用
- 使用AdvinceInstaller把exe或者msi重新包装成为msi静默安装程序
- javascript 键盘输入过滤,只能输入数字,小数一位且只能输入5
- MapReduce实现二度好友关系
- 20160808_Shell书
- 获取iOS设备的内存状况(转)
- C#客户端链接网页需要用到的WebClient
- 基于node/mongo的App Docker化测试环境搭建
- 关于void*函数返回
- 04737_C++程序设计_第4章_类和对象
- [Sdoi2017]相关分析 [线段树]
- ●UOJ 34 多项式乘法
- PostgreSQL 数据库备份
- java实操之使用jcraft进行sftp上传下载文件
- Vue(二) 计算属性
- 经典面试题SALES TAXES思路分析和源码分享
- tex---就是tex文件,这个地球人都知道,是文章所在的主要文件
- hdoj:2028