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 ...
随机推荐
- android开发布局文件imageview 图片等比例缩放:
ImageView的属性scaleType,如果等比缩放的话,就使用CenterInside,如果想固定大小的话,就CenterCrop <?xml version="1.0" ...
- Java字符串格式化String.format常用用法
常规的格式化 String类的format()方法用于创建格式化的字符串以及连接多个字符串对象.熟悉C语言的同学应该记得C语言的sprintf()方法,两者有类似之处.format()方法有两种重载形 ...
- WPF下递归生成树形数据绑定到TreeView上
最终效果图:(用于学习类的效果 图片丑了点,看官莫怪) 新建窗体 然后在前端适当位置插入如下代码: <TreeView x:Name="> <TreeView.ItemTe ...
- Atitit. Atiposter 发帖机 新特性 poster new feature v7 q39
Atitit. Atiposter 发帖机 新特性 poster new feature v7 q39 V1 初步实现sina csdn cnblogs V2 实现qzone sohu 的发帖 ...
- Windows 下Apace tomcat
java JDK安装: 1. 官方www.oracle.com 下载jdk 2. 环境变量配置 (1)新建->变量名:JAVA_HOME变量值:C:\Program Files (x86)\Ja ...
- 在Seismic.NET下用最少的语句写出一个剖面显示程序
用Seismic.NET开发地震剖面显示程序可以节省大量的时间,下面的代码展开了如何用最少的代码显示一个SEGY文件. // 用一行语句把 reader, pipeline, view 和 plot ...
- iOS 7中实现模糊效果
本文译自iOS 7 Blur Effects with GPUImage. iOS 7在视觉方面有许多改变,其中非常吸引人的功能之一就是在整个系统中巧妙的使用了模糊效果.许多第三方应用程序已经采用了这 ...
- Cent OS服务器配置(JDK+Tomcat+MySQL)
本文摘自:Cent OS服务器配置(JDK+Tomcat+MySQL) 学习tar解压 解压 tar 文件 tar -zxvf apache-tomcat-6.0.35.tar.gz tomcat ...
- android activity 管理器AMS----概述
AMS & WMS,应该是app端打交道最多的2个framwork层的service. ActivityManagerService 是android提供给用于管理Activity运行状态的系 ...
- Linux 基础知识----shell
1.file title: #!/bin/bash 2.input: echo $1 echo $2 3.if # ifif [ "$1" = "N" ]the ...