title: Use different prefixes in spring boot @Configuration/@ConfigurationProperties
body: <p>I have spring boot app, and <code>.yaml</code> file with such configuration:</p>
  <pre><code>storage:
    path: C:\\path\\example
  cache:
    durtion: 60
  </code></pre>
  <p>I need ONE class, that will contain both cache and storage. I thought that @ConfigurationProperties will help me, but the only thing I can do with this annotation is creating two different classes:</p>
  <pre><code>@Component
  @ConfigurationProperties(prefix = &quot;storage&quot;)
  public class ConfigA(){
       @Getter
       @Setter
       private String path;
  }
  ...
  
  @Component
  @ConfigurationProperties(prefix = &quot;cache&quot;)
  public class ConfigB(){
       @Getter
       @Setter
       private int duration;
  }
  </code></pre>
  <p>How can I combine <code>ConfigA</code> and <code>ConfigB</code> in one class?
  Is it possible to it without using <code>@Value</code>?
  Update:
  I've managed to do something like this, but I'm not sure this is the best way:</p>
  <pre><code>@Configuration
  public class ValuesConfig {
  
      @Bean
      @ConfigurationProperties(prefix = &quot;cache&quot;)
      public Cache cache(){
          return new Cache();
      }
  
      @Component
      public static class Cache{
          @Getter
          @Setter
          private int duration;
      }
  
  }
  </code></pre>