@ConfigurationProperties获取配置信息

@ConfigurationProperties

maven

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-configuration-processor</artifactId>
	<optional>true</optional>
</dependency>

配置
在这里插入图片描述
实体获取配置

在这里插入图片描述

测试
在这里插入图片描述
嵌套获取配置

在这里插入图片描述

参考文章

Generating Your Own Metadata by Using the Annotation Processor

发布了212 篇原创文章 · 获赞 30 · 访问量 19万+

猜你喜欢

转载自blog.csdn.net/weixin_38336658/article/details/103743023