title: Creating multiple beans by a list in properties
body: <p>Basically, I would like to create beans by a list in my application.yml file.</p>
  <p>I have to use multiple Liquibase changelog files within my Spring Boot application. Sadly, I can't do it in spring boot's configuration and I cannot put these files into one file, because the number of changelog files is always changing. Not an ideal situation but I cannot do anything against it now.
  So, I figured out that defining Liquibase beans can help me out. Changelog files are getting used in the right order. But I want to add the files in the <code>application.yml</code> file.</p>
  <pre class="lang-yaml prettyprint-override"><code>myconfig:
    - pathToChangeLogFile_1
    - pathToChangeLogFile_2
    - pathToChangeLogFile_3
  </code></pre>
  <pre class="lang-java prettyprint-override"><code>import java.sql.DataSource;
  import liquibase.integration.spring.SpringLiquibase;
  
  @Configuration
  class LiquibaseConfiguration {
      
      @Bean
      public SpringLiquibase firstLiquibase(Datasource dataSource) {
          SpringLiquibase liquibase = new SpringLiquibse();
          liquibase.setDataSource(dataSource);
          // ...
          // other method calls
          liquibase.setChangeLog(&quot;pathToChangeLogFile_1&quot;);
          return liquibase;
      }
  
      @Bean
      @DependsOn(&quot;firstLiquibase&quot;)
      public SpringLiquibase secondLiquibase(Datasource dataSource) {
          SpringLiquibase liquibase = new SpringLiquibse();
          liquibase.setDataSource(dataSource);
          // ...
          // other method calls
          liquibase.setChangeLog(&quot;pathToChangeLogFile_2&quot;);
          return liquibase;
      }
  
      // Other beans and etc.
  }
  </code></pre>
  <p>I don't want to rewrite my code every time a file is getting added. How would I create beans in spring by the application property config (list)? I thought of some kind of bean factory but I don't know how should I make sure my bean is getting the <code>DataSource</code> there which is pretty straightforward with bean definition.
  I looked at <code>ImportBeanDefinitionRegistrar</code>, <code>EnvironmentAware</code>, <code>BeanFactoryAware</code> interfaces but I can't tell if I am on the good track.</p>