Thursday, 16 March 2017

Custom Banner in Spring Boot

Custom Banner
Every time you run your application, you can see a banner being displayed at the beginning of the
application. That banner can be customized in different ways. Listing 3-11 shows how to implement the
org.springframework.boot.Banner interface.

-- src/main/java/com/naarendra/spring/SpringBootSimpleApplication.java
package com.narendra.spring;
import java.io.PrintStream;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;
@SpringBootApplication
public class SpringBootSimpleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SpringBootSimpleApplication.class);
app.setBanner(new Banner() {
@Override
public void printBanner(Environment environment, Class<?> sourceClass,
PrintStream out) {
out.print("\n\n\tThis is my own banner!\n\n".toUpperCase());
}
});
app.run(args);
}
}



You can also create your own ASCII banner and display it. There is a very cool site that creates ASCII art
from text ( http://patorjk.com ).




Related Posts:

  • Life Cycle Of JDBC Read More
  • Java EE 7 Platform Highlights(Whats new in java 7) The most important goal of the Java EE 7 platform is to simplify development by providing a co… Read More
  • SQL dumps Created by BCL easyConverter SDK 3 (HTML Version) body {margin-top: 0px;margin-left: 0px;} #page_1 {position:relative; overflow: hidden;margi… Read More
  • Interface इंटरव्यू में सबसे अधिक  पूछे  जाने वाले  सवालो में Interface सबसे ऊपर आता है जिसमे Tricky प्रश्न बन जाते है ,और स्टूडें… Read More
  • Consumer Producer Problem with Solution import java.util.Vector; /**  * Java program to solve Producer Consumer problem using wait and notify  * method in Java. Producer Con… Read More