简体   繁体   中英

Equivalent of @ConfigurationProperties(prefix=“foo”) over an external Properties object?

CustomProperties对象在外部库中,因此我无法添加注释,但是我仍然想通过前缀从Spring Boot YAML馈入注释。

Found it!

In the @Configuration:

  @Bean
  @ConfigurationProperties("company.custom")
  public CustomProperties customProperties(){
    return new CustomProperties();
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM