读取properties中value
来源:互联网 发布:网络架构培训 编辑:程序博客网 时间:2024/05/16 06:36
import java.text.MessageFormat;import java.util.Properties;import org.springframework.beans.BeansException;import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;public class ExpandPropertyPlaceholderConfigurer extendsPropertyPlaceholderConfigurer {private static Properties myProperties=new Properties();@Overrideprotected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess,Properties props) throws BeansException {// TODO Auto-generated method stubsuper.processProperties(beanFactoryToProcess, props);myProperties.putAll(props);}/** * 获取配置 * @param key * @return */public static String getProperty(String key){return myProperties.getProperty(key);}/** * 获取配置 * @param key * @param param 要替换的值 * @return */public static String getProperty(String key,Object[] param){return MessageFormat.format(getProperty(key), param);}}<beanclass="com.sf.customer.service.core.util.ExpandPropertyPlaceholderConfigurer"><property name="ignoreResourceNotFound" value="true" /><property name="locations"><list><value>classpath:jdbc.properties</value><value>classpath:system.properties</value><value>classpath:message.properties</value></list></property></bean>
阅读全文
0 0
- 读取properties中value
- 通过@Value注解读取.properties配置内容
- 通过@Value注解读取.properties配置内容
- 通过@Value注解读取.properties配置内容
- SpringMVC通过@Value注解读取.properties配置
- @Value注解读取.properties配置内容
- 通过@Value注解读取.properties配置内容
- SpringMVC通过@Value注解读取.properties配置
- 通过@Value注解读取.properties配置内容
- Spring 读取properties文件key+value方式
- 通过@Value注解读取.properties配置内容
- spring使用注解@Value读取.properties文件
- 通过@Value注解读取.properties配置内容
- 在Spring-boot中,为@Value注解添加从数据库读取properties支持
- android中读取properties
- springmvc通过@Value注解读取Properties配置文件的值,junit测试可以取到值,但是在业务中无法读取
- @Value获取properties文件中数据
- 读取properties文件中数据
- (1)字符串置换
- 【读书笔记】JavaScript权威指南 --前言&第一章 javascript概述
- PyCharm 基本操作
- android studio 各种问题
- Jenkins+maven+jmeter接口可持续集成自动化测试
- 读取properties中value
- 几种进程间的通信方式
- J.U.C-Fork/Join框架
- Java Web Start
- 部署服务器(网站,数据库) | 华为手机允许日志记录
- 一点一滴探究JVM之类加载机制
- CSDN这是要搞事
- 经典CSS实现三角形图标原理解析
- Python学习_我要使用if判断语句