Contexts are ignored in Spring Boot application

Hi,

I’ve defined below property in a Spring Boot application:

spring.liquibase.contexts: test

And a change set has been annotated like this:

– changeset author:1 context:prod

When I run the Spring boot application the script annotated with context prod is executed.

Any idea why?

1 Like

while context is fine (at the time of writing), it is a deprecated alias. Use contextFilter instead.

Double check that the active profile you are running the application with sets at least one liquibase context (even if you are not using it). The liquibase default setting behaves as follows:

If you do not specify any contexts in the CLI at runtime, every changeset in your changelog runs, even if they have contextFilters attached

In my case, I added a spring.liquibase.contexts: base to my application yaml. My other profiles override it if they need to, for running specific contexts (i.e. test)