配置绑定
2025-4-20
| 2025-4-20
Words 160Read Time 1 min
type
status
date
slug
summary
tags
category
icon
password
将properties文件和JavaBean进行绑定,我们在properties配置了一些属性,怎么才能将这些配置集成到JavaBean中呢

环境准备

创建furn的Bean对象

创建配置文件

通过@ConfigurationProperties(prefix = “furn01”),就可以将配置文件和bean对象结合起来。

测试

结果

notion image
image-20230402212800030
配置绑定:-ConfigurantionProperties配置信息的重用
Loading...