Database / Liquibase interview questions
How do you integrate Liquibase with Spring Boot?
Spring Boot has first-class auto-configuration for Liquibase. When you add the spring-boot-starter-data-jpa or the dedicated liquibase-core dependency alongside Spring Boot, the auto-configuration detects the Liquibase JAR and automatically runs migrations at application startup before the application context fully initialises. This means your schema is always in sync before your application starts serving requests.
Maven dependency:
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>By default, Spring Boot looks for the changeLog at classpath:db/changelog/db.changelog-master.yaml. You can override this and other settings in application.properties:
spring.liquibase.change-log=classpath:db/changelog/db.changelog-master.xml
spring.liquibase.enabled=true
spring.liquibase.contexts=dev
spring.liquibase.default-schema=myapp
spring.liquibase.drop-first=false # NEVER true in production
spring.liquibase.user=migration_user # separate low-privilege DB user for migrations
spring.liquibase.password=secretA good practice is running Liquibase with a separate database user (spring.liquibase.user) that has DDL permissions, while the main application datasource user has only DML rights. This limits the blast radius if the application is compromised — the app can read/write rows but cannot drop tables. The drop-first=true option drops the entire schema before running migrations and should never be enabled in production; it is occasionally useful in isolated test environments.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
