title: How to convert few yaml properties to class in spring boot
body: <p>I have following application-yml.</p>
  <pre><code>server:
    port: 9090
  
  spring:
     application:
        name: employee-management
  
  employee:
     details:
       firstname: John
       lastname: DK
  
       firstname: Henry
       lastname: K
  
       firstname: Sofiya
       lastname: H
  </code></pre>
  <p>And my Java class</p>
  <pre><code>@Builder
  @AllArgsConstructor
  @NoArgsConstructor
  @Configuration
  @ConfigurationProperties(prefix = &quot;employee&quot;)
  public class Employee{
    public List&lt;Name&gt; details;
  }
  </code></pre>
  <p>But along with employee properties, it's also reading other spring properties.</p>
  <pre><code>Yaml yaml = new Yaml();
      InputStream inputStream = class.getClassLoader().getResourceAsStream(&quot;application.yml),
      Employee obj = yaml.loadAs(inputStream, Employee.class);
  </code></pre>
  <p>I am getting this following error.</p>
  <pre><code>Cannot create property=server for JavaBean=com.example.common.util.Employee@7d365620
   in 'reader', line 1, column 1:
      server:
      ^
  Unable to find property 'server' on class: com.example.common.util.Employee
   in 'reader', line 2, column 3:
        port: 9090
  </code></pre>
  <p>How can I avoid other spring properties while reading the resource file?
  Thanks in Advance!</p>