简体   繁体   中英

LiquibaseAutoConfiguration Beans tries to load on exclude

I am getting below error while running the integration test case from intellij even though I have excluded the LiquibaseAutoConfiguration from the EnableAutoConfiguration . What am I missing here?

Caused by: java.lang.IllegalStateException: Cannot find changelog location: class path resource [db/changelog/db.changelog-master.yaml] (please add changelog or check your Liquibase configuration)
    at org.springframework.util.Assert.state(Assert.java:385)
    at org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration$LiquibaseConfiguration.checkChangelogExists(LiquibaseAutoConfiguration.java:83)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:349)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:300)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
    ... 55 more


Process finished with exit code 255




@ComponentScan 
@EnableAutoConfiguration(exclude = {
            EmbeddedServletContainerAutoConfiguration.EmbeddedJetty.class,
            LiquibaseAutoConfiguration.class,
            SecurityAutoConfiguration.class,
            ManagementSecurityAutoConfiguration.class,
            SolrAutoConfiguration.class
    })
    @Configuration
    public class App {

It would appear that your use of the bare @ComponentScan annotation picks up other @Configuration classes that are annotated with @EnableAutoConfiguration but without the excludes.

Thus, the fix likely involves explicit configuration of what should be picked up via component scanning. See the Javadoc for @ComponentScan for further details and options (eg, basePackages , useDefaultFilters , includeFilters , excludeFilters , etc.).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM