文章目录 1、新增properties文件2、修改spring相关xml文件3、项目中读取properties中变量 1、新增properties文件 2、修改spring相关xml文件 <context:property-placeholder location="classpath:properties/config.properties" /> spring框架就会去读取这个properties文件 3、项目中读取properties中变量 读取properties中变量key的值 @Value("${key}") private String key;