All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.luues.core.banner.Banner Maven / Gradle / Ivy

There is a newer version: 2.0.1.RELEASE
Show newest version
package com.luues.core.banner;

import org.springframework.boot.SpringBootVersion;
import org.springframework.core.env.Environment;
import java.io.*;

public class Banner implements org.springframework.boot.Banner {
    @Override
    public void printBanner(Environment environment, Class aClass, PrintStream printStream) {
        InputStream is = Banner.class.getClassLoader().getResourceAsStream("logo.txt");
        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
        String line = null;
        try {
            while ((line = reader.readLine()) != null) {
                if(line.contains("#{bootVersion}")){
                    line = line.replace("#{bootVersion}", SpringBootVersion.getVersion());
                }
                printStream.println("\u001b[48;35m" + line + "\u001b[0m");
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy