1.在resources目录下创建一个test.properties文件

Spring日常笔记记录09--用${}为属性赋值_赋值

 

 

 

 

2.在xml映射文件中获取test.properties文件的信息

 

<!--加载属性配置文件-->
    <context:property-placeholder location="classpath:test.properties"/>

 

Spring日常笔记记录09--用${}为属性赋值_spring_02

 

 

 

 

3.在类的声明上面添加注解(应用${})

Spring日常笔记记录09--用${}为属性赋值_properties文件_03

 

 

Spring日常笔记记录09--用${}为属性赋值_配置文件_04

 

 
 
 
 
posted on 2021-07-16 01:35  Brack_Pearl  阅读(3)  评论(0)  编辑  收藏  举报