开发者社区 问答 正文

Spring Boot 有哪几种读取配置的方式?

Spring Boot 有哪几种读取配置的方式?

展开
收起
真的很搞笑 2021-10-21 22:23:17 496 分享 版权
1 条回答
写回答
取消 提交回答
  • Spring Boot 目前支持 2 种读取配置: @Value 注解,读取配置到属性。最最最常用。 另外,支持和 @PropertySource 注解一起使用,指定使用的配置文件。 @ConfigurationProperties 注解,读取配置到类上。 另外,支持和 @PropertySource 注解一起使用,指定使用的配置文件。

    2021-10-21 22:23:36
    赞同 展开评论