I am using Spring boot and Liquibase. Using this URL as a recommendation
http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/
The following entry is present in pom.xml , so Spring boot knows about the campaign.
<dependency> <groupId>org.liquibase</groupId> <artifactId>liquibase-core</artifactId> </dependency>
and put the change file in the resources folder. db.changelog-master.xml
Now Spring, load tring first to find db.changelog-master.yaml in the classpath and throw an exception like this.
Cannot find change location: class path resource [db / changelog / db.changelog-master.yaml
To fix the problem, I added a bean, as shown below in my class, and tried to set the changeLog property.
@Configuration @ComponentScan @EnableAutoConfiguration public class SampleDataJpaApplication { @Autowired LiquibaseProperties properties; @Autowired private DataSource dataSource; @Bean public SpringLiquibase liquibase() { SpringLiquibase liquibase = new SpringLiquibase(); properties.setChangeLog("classpath:/db/changelog/db.changelog-master.xml"); liquibase.setChangeLog(this.properties.getChangeLog()); liquibase.setContexts(this.properties.getContexts()); liquibase.setDataSource(this.dataSource); liquibase.setDefaultSchema(this.properties.getDefaultSchema()); liquibase.setDropFirst(this.properties.isDropFirst()); liquibase.setShouldRun(this.properties.isEnabled()); return liquibase; } public static void main(String[] args) throws Exception { Logger logger = LoggerFactory.getLogger("SampleDataJpaApplication"); SpringApplication springApplication = new SpringApplication(); springApplication.run(SampleDataJpaApplication.class, args); } }
but it does not work with the message.
org.springframework.beans.factory.BeanCreationException: error creating a bean named 'sampleDataJpaApplication': Injection autosure dependencies failed; org.springframework.beans.factory.BeanCreationException nested exception: autowire field failed: org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties sample.data.jpa.SampleDataJpaApplication.properties; the nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualification bean of type [org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties] found for the dependency: at least 1 bean is expected that qualifies as an autwire candidate for this dependency. Dependency Annotations: {@ Org.springframework.beans.factory.annotation.Autowired (required = true)}
Called: org.springframework.beans.factory.BeanCreationException: Autwire failed to create: org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties sample.data.jpa.SampleDataJpaApplication.properties; the nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualification bean of type [org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties] found for the dependency: at least 1 bean is expected that qualifies as an autwire candidate for this dependency. Dependency Annotations: {@ Org.springframework.beans.factory.annotation.Autowired (required = true)}
Please provide input here why I am getting this exception or is there any other available way to override the same class so that I can change the changeLog property of Liquibase properties.
spring-boot liquibase
Kul bhushan prasad
source share