title: configure dataSource for liquibase in spring boot
body: <p>I have a spring boot application and I want to add liquibase configuration change log for it.</p>
  
  <p>I have created a LiquibaseConfig class for configuring liquibase:</p>
  
  <pre><code>@Configuration
  public class LiquibaseConfiguration {
  
      @Value("${com.foo.bar.liquibase.changelog}")
      private String changelog;
  
      @Autowired
      MysqlDataSource dataSource;
  
      @Bean
      public SpringLiquibase liquibase()  {
          SpringLiquibase liquibase = new SpringLiquibase();
          liquibase.setDataSource(dataSource);
          liquibase.setChangeLog(changelog);
          return liquibase;
      }
  
  }
  </code></pre>
  
  <p>and I have configured the datasource information in properties file:</p>
  
  <pre><code>spring.datasource.url=jdbc:mysql://localhost:3306/dms
  spring.datasource.username=root
  spring.datasource.password=test
  spring.datasource.testWhileIdle = true
  spring.jpa.show-sql = true
  
  #liquibase
  com.foo.bar.liquibase.changelog=classpath:/db/changelog/db.changelog.xml
  </code></pre>
  
  <p>when I run my application I receive this error:</p>
  
  <pre><code>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liquibaseConfiguration': Unsatisfied dependency expressed through field 'dataSource': No qualifying bean of type [com.mysql.jdbc.jdbc2.optional.MysqlDataSource] found for dependency [com.mysql.jdbc.jdbc2.optional.MysqlDataSource]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.mysql.jdbc.jdbc2.optional.MysqlDataSource] found for dependency [com.mysql.jdbc.jdbc2.optional.MysqlDataSource]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  </code></pre>
  
  <p>Now I understood that this means the application cannot autowire the <code>MysqlDataSource dataSource;</code> but I need to pass the data source to liquibase bean. How can I do that?</p>