Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can liquibase banner be turned off in spring boot?

I am setting up liquibase in a spring boot app. On app startup liquibase overrides default spring boot banner and shows a liquibase banner:

####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ## 
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ## 
##  Get advanced features and support at          ##
##      liquibase.com/support                     ##
##                                                ##
####################################################

How can I go back to default spring boot banner? I know that I can disable banners in spring boot, load a banner from a file, but I believe I should be able to explictly tell liquibase to stop showing it's banner.

like image 487
Mindaugas Volskas Avatar asked Oct 28 '20 10:10

Mindaugas Volskas


People also ask

How to Disable banner in Spring boot?

Another way to disable the Spring Boot startup banner is to change the banner text to an empty file. Then we create a new empty file in src/main/resources named banner. txt.

How do I turn off Liquibase in spring boot?

For Spring 5.liquibase. enabled=false application property disables Liquibase.

How to disable Liquibase in spring application?

For Spring 5.x.x: the spring.liquibase.enabled=false application property disables Liquibase. P.S. And for Flyway: Add liquibase.enabled=false in your application.properties file But if you don't want to use liquibase from application anymore, remove liquibase starter altogether from pom. This property was migrated to spring.liquibase.enabled.

How to disable the default banner in Spring Boot?

You can disable the default banner by setting the spring.main.banner-mode property to off. The default value for this properties entry is console which means the output is not part of the logs. Apart from off and console this property can take log as one more value where the banner info is printed on the logs.

Why do I have to remove the Liquibase starter?

That's why you have to remove the liquibase starter, or any direct liquibase dependency if you added any. If you only have the liquibase maven plugin, liquibase is not in the application classpath.

Is Spring Boot right for You?

Introduction Spring Boot is a great way to create Java web applications, but some of its default behavior may not be ideal for everyone. One particular feature is the Spring Boot banner that gets printed at startup:


Video Answer


1 Answers

In Liquibase 3.10.3/4.1.1 its banner has been extracted to the separate file called banner.txt. So, starting from these versions, this file will be in the classpath if you have the liquibase-core dependency.

Surprisingly, Spring relies on a file with the same name when it chooses the banner text. As a result, it takes Liquibase's banner accidentally and prints it. So, it's not really a fault of Liquibase.

Maybe we can raise an issue in Liquibase repo to ask them about renaming that file for the convenience of all Spring users. But for now, I see the only way to fix it - to use Spring's standard approaches of working with banners as you said (of course, it' always possible to downgrade Liquibase version too).

EDIT: Found that the issue about it has already been raised: https://github.com/liquibase/liquibase/issues/1476

EDIT 2: The problem has been fixed in Liquibase 4.2.0 by moving the banner.txt to the different location. See the release notes.

like image 186
amseager Avatar answered Oct 17 '22 18:10

amseager