Spring 中注入 properties 中的值
<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;
Spring 中注入 properties 中的值的更多相关文章
- spring boot 在框架中注入properties文件里的值(Spring三)
前一篇博客实现了打开第一个页面 链接:https://blog.csdn.net/qq_38175040/article/details/105709758 本篇博客实现在框架中注入propertie ...
- 使用注解注入properties中的值的简单示例
spring使用注解注入properties中的值的简单示例 1.在web项目的src目录下新建setting.properties的文件,内容如下: version=1 2.在spring的xm ...
- spring注解注入properties配置文件
早期,如果需要通过spring读取properties文件中的配置信息,都需要在XML文件中配置文件读取方式. 基于XML的读取方式: <bean class="org.springf ...
- Spring3中用注解直接注入properties中的值
在bean(可是controller, service, dao等了)中,使用@Value注解: @Service public class TestService{ @Value("${s ...
- AndroidStudio 中 gradle.properties 的中文值获取乱码问题
0x01 现象 在gradle.properties中定义了全局变量,然后从 build.gradle 中设置 app_name: resValue "string", " ...
- Spring自动注入properties文件
实现spring 自动注入属性文件中的key-value. 1.在applicationContext.xml配置文件中,引入<util />命名空间. xmlns:util=" ...
- Java中如何获取spring中配置文件.properties中属性值
通过spring配置properties文件 1 2 3 4 5 6 7 8 9 <bean id="propertyConfigurer" class="co ...
- winform中获取Properties窗口的值.
我写这个工具,主要是多次在将自己的代码和别人代码做对比时,不想繁琐地用眼看他设置的和自己设置的哪里不一样. using System; using System.Collections.Generic ...
- Maven项目中在properties 中使用 ${} 来引用pom文件中的属性
比如在pom文件中定义了属性如下: <jdbc.host.global>127.0.0.1</jdbc.host.global> <jdbc.databasename.g ...
随机推荐
- J2EE分布式架构及MySQL交流群
J2EE分布式架构及MySQL交流群:577913057
- Automapper扩展方法
问题描述 系统中实现了一个自定义的PagedList /// <summary> /// Paged list interface /// </summary> public ...
- 自己写的表格插件autotable
自己写的表格插件autotable 作者:田想兵,个人网址:http://www.lovewebgames.com 这个表格插件所完成的功能是:ajax请求数据,然后动态绑定到指定表格下,格式化,分页 ...
- Java对象 json之间的转换(json-lib)
在这里主要简单的介绍一下,如何使用json-lib这个工具包来完成Java对象(或集合)与json对象(或集合)之间的转换~ 1. Java对象转换成json(既创建json) 关键类:JSONObj ...
- 使用SWFUpload无刷新上传图片
使用SWFUpload组件无刷新上传图片 在做项目时,需要用到一个图片的无刷新上传,之前听说过SWFUpload,于是想要通过SWFUpload来进行图片的无刷新上传,由于我的项目属于是ASP.NET ...
- iOS开发之网络编程--使用NSURLConnection实现文件上传
前言:使用NSURLConnection实现文件上传有点繁琐. 本文并没有介绍使用第三方框架上传文件. 正文: 这里先提供用于编码测试的接口:http://120.25.226.186:3281 ...
- window平台下的MySQL快速安装。(不好意思,未完成待续,请飘过)
MySQL安装方式 MSI安装(Windows Installer) ZIP安装 最好选择ZIP安装,比较干净,也快速搞好. 下载链接:http://pan.baidu.com/s/1sjFZZul ...
- Android之 左右滑动菜单
近来学习了极客学院有关于界面左右滑动的视频,就在这里写个博客,巩固一下知识点,以免忘了. 这里主要介绍界面是如何左右滑动的: 1.首先我们应该设置好将要滑动的三个界面,即leftMenu.middle ...
- java中使用split分割字符串一个有趣的现象
最近在项目中,发现了一个bug,充分了展示了自己对java底层的认知有很多的不足和欠缺. 下面有段代码: String str="1#2#3"; String[] strs=str ...
- img标签使用默认图片的一种方式
基于html5提供的onerror这个时间属性.