0
点赞
收藏
分享

微信扫一扫

Spring boot 将配置文件属性注入到一个bean中

现在要做的就是将如下配置文件中的内容注入到一个bean 名为Properties中。

Redis.properties配置文件中的内容如下:

Spring boot 将配置文件属性注入到一个bean中_Redis

Properties java bean中代码如下,注意注解的使用:

Spring boot 将配置文件属性注入到一个bean中_java_02

测试类代码:

Spring boot 将配置文件属性注入到一个bean中_配置文件_03

打印结果为:

Spring boot 将配置文件属性注入到一个bean中_配置文件_04



举报

相关推荐

0 条评论