注解形式读取properties文件中的属性

Posted 咸蛋超人

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了注解形式读取properties文件中的属性相关的知识,希望对你有一定的参考价值。

1、spring.xml中加入(多个properties 用逗号隔开)  <context:property-placeholder location="classpath:jdbc.properties,classpath:config.properties" />

2、spring-mvc.xml 中加入(只加上面一句controller中读取不到值) <context:property-placeholder location="classpath:config.properties" />

 

以上是关于注解形式读取properties文件中的属性的主要内容,如果未能解决你的问题,请参考以下文章

属性文件操作之Properties与ResourceBundle

@Scheduled注解中的值从配置文件中读取

spring boot框架学习之重要注解3注解方式读取外部资源配置文件

Spring注解驱动开发--属性赋值

HTML文件:通过IHTMLDocument添加注解

Java读取Properties配置文件