Close

Spring Boot - Customizing Banner Examples

Spring Boot 

Creating a custom implementation of org.springframework.boot.Banner.

package com.logicbig.example;

import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.core.env.Environment;

import java.io.PrintStream;
import java.net.MalformedURLException;

public class CustomBannerExample {
public static void main (String[] args) throws MalformedURLException {
SpringApplication app = new SpringApplication(CustomBannerExample.class);
app.setLogStartupInfo(false);
app.setBanner(new Banner() {
@Override
public void printBanner (Environment environment,
Class<?> sourceClass,
PrintStream out) {
out.println("--- my custom banner ---");
}
});
app.run(args);
}
}

Output

--- my custom banner ---
Original Post




using image for banner. Spring boot will convert image to text.

package com.logicbig.example;

import org.springframework.boot.ImageBanner;
import org.springframework.boot.SpringApplication;
import org.springframework.core.io.UrlResource;

import java.net.MalformedURLException;

public class ImageBannerExample {
public static void main (String[] args) throws MalformedURLException {
SpringApplication app = new SpringApplication(ImageBannerExample.class);
UrlResource r = new UrlResource("http://www.logicbig.com/tutorials/" +
"spring-framework/spring-boot/" +
"images/spring-boot.png");
app.setBanner(new ImageBanner(r));
app.setLogStartupInfo(false);
app.run(args);
}
}

Output



8888888&&&&&&&&&&&&&&&&&ooooooooooooo:::::::::::::::
8888888&&&&&&&&&&&&&&&&&oooooooooooo::::::::::::::::
8888888&&&&&&&&&&&&&&&&&&&oo:ooooooo::::::::::::::::
8888888&88&&&&&&&&&&&&&&& o. ::::::::::::::::
8888888888&&&&&&&&&&&&&&8 .8& * .:::::::::::::::
8888888&88&&&&&&&&&&&&&&o 88 *o :::::::::::::::
8888888&&&&&&&&&&&&&&&&&8 o ::::::::::::::::
8888888888&&&&&&&&&&&&&&&8 oo oo:::::::::::::::
8888888888&&&&&&&&&&&&&&8 *:::::::::::::::
8888888888&&&&&&&&&&&&&&& *:::::::::::::::
8888888888&&&&&&&&&&&&&&&&&88 :oo *:::::::::::::::
8888888888&&&&&&&&&&&&&&&&&88 *:::::::::::::::
8888888888&&&&&&&&&&&&oo&&&888 ::::::::::::::::
88888888888&&&&&&&&&&&&&& *:::::::::::::::
88888888888&&&&&&&&&&&&&& *:::::::::::::::
888888888 &&&&&&&&&888 oo *:::::::::::::::
888888888 & & &&&&&&&&88 oo *:::::::::::::::
888888888 & &&&&&&&& ::::::::::::::::
888888888. & &&&&&&&&& 888&: .:::::::::::::::::
8888888888& *&&&&&&&&&& . : ::::::::::
888888888 &&&&&&&& * * :::::::::
88888888 8&&&& &&&&&&&&:::::****..::: *::::::::
888888888 .. &&&&&&&& *::::::**:::::::
8888888888 &&&&&&&&&&&&888 ::::::::::::::::
8888888888& *&&&&&&&&&&88 o::::::::::::::::::
888888888 &&&&&&&& *:::::::::::::::
88888888 8&&&& &&&&&&&& *:::::::::::::::
888888888 .. &&&&&&&&&888. .ooo:::::::::::::::::
8888888888 &&&&&&&&&&8 :::::::::::::::::
88888888888&&&& &&&&&&&& *8&o. ::::::::::::::::
888888888&&&&&& &&&&&&&o &o&&ooo :::::::::::::::
888888888 &&&&&&&& && oo :::::::::::::::
88888888888&&&& &&&&&&&& oo ::::::::::::::::
88888888888&&&&&&&&&&&&&o&*....ooo::::::::::::::::::
8888888888&&&&&&&&&&&&&&oooooooo::::::::::::::::::::
8888888888&&&&&&&&&&&&&&oooooooo::::::::::::::::::::
Original Post




See Also