---
title: "spring PreferencesPlaceholderConfigurer对properties文件读取值"
author: "艾伦蓝"
date: "2017-12-01T16:55:16Z"
tags: []
categories: ["编程语言"]
slug: "spring-preferencesplaceholderconfigurer-properties"
draft: true
lastmod: "2017-12-01T16:58:36Z"
id: 2401601
url: "https://forlan.iteye.com/blog/2401601"
---

\[color=red]\[b]1.创建config.propertites文件 \[/b]\[/color] \[code="txt"] key=value \[/code] \[color=red]\[b]2.配置文件applicationContext.xml\[/b]\[/color] \[code="xml"] classpath:\*.properties \[/code] \[color=red]\[b]3.java类中引用\[/b]\[/color] \[code="java"] // id=setting中找key的值 @Value("${key}") private String key; \[/code]