diff --git a/nutzboot-starter/src/main/java/org/nutz/boot/NbApp.java b/nutzboot-starter/src/main/java/org/nutz/boot/NbApp.java index 86074213..396afc61 100644 --- a/nutzboot-starter/src/main/java/org/nutz/boot/NbApp.java +++ b/nutzboot-starter/src/main/java/org/nutz/boot/NbApp.java @@ -18,6 +18,7 @@ import org.nutz.boot.config.impl.PropertiesConfigureLoader; import org.nutz.boot.env.SystemPropertiesEnvHolder; import org.nutz.boot.ioc.IocLoaderProvider; import org.nutz.boot.resource.ResourceLoader; +import org.nutz.boot.resource.StaredLogoLoaderDD; import org.nutz.boot.resource.impl.SimpleResourceLoader; import org.nutz.ioc.Ioc2; import org.nutz.ioc.IocLoader; @@ -90,16 +91,8 @@ public class NbApp { if (!Strings.isBlank(logAdapter)) { Logs.setAdapter((LogAdapter) ctx.getClassLoader().loadClass(logAdapter).newInstance()); } + StaredLogoLoaderDD.printLogo(); log = Logs.get(); - log.debug(" \n" + - " _ \n" + - " ____ _ _ _| |_ _____ \n" + - "| _ \\| | | (_ _(___ )\n" + - "| | | | |_| | | |_ / __/ \n" + - "|_| |_|____/ \\__(_____)\n" + - " " + - "\n:: Nutz Boot :: "+ Nutz.version()+"\n"); - // 资源加载器 if (ctx.getResourceLoader() == null) { ResourceLoader resourceLoader = new SimpleResourceLoader(); diff --git a/nutzboot-starter/src/main/java/org/nutz/boot/resource/StaredLogoLoaderDD.java b/nutzboot-starter/src/main/java/org/nutz/boot/resource/StaredLogoLoaderDD.java new file mode 100644 index 00000000..6f58136e --- /dev/null +++ b/nutzboot-starter/src/main/java/org/nutz/boot/resource/StaredLogoLoaderDD.java @@ -0,0 +1,46 @@ +package org.nutz.boot.resource; + +import org.nutz.Nutz; +import org.nutz.boot.resource.impl.SimpleResourceLoader; +import org.nutz.log.Logs; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * NB启动时的LOGO加载类 + * + * @Author 蛋蛋-wqh + * @Date 2017年11月7日 19:04:42 + */ + +public class StaredLogoLoaderDD { + + public static void printLogo(){ + try { + String str = "\n \n _ _ _ \n" + + " | \\ | | _ _ _| |_ ____\n" + + " | \\| || | | |_| __||_ /\n" + + " | |\\ || |_| | | |_ / / \n" + + " |_| \\_| \\__,_| \\__|/___|" + + "\n:: Nutz Boot :: ("+ Nutz.version()+")\n"; + InputStream inputStream = new SimpleResourceLoader().get("banner.txt"); + if(inputStream!=null){ + str = ""; + try (BufferedInputStream bi = new BufferedInputStream(inputStream)) { + byte[] buf = new byte[1024]; + int read = 0; + while((read = bi.read(buf))!=-1){ + str+=new String(buf,"utf-8"); + } + str+="\n:: Nutz Boot :: ("+ Nutz.version()+")\n"; + } + } + Logs.get().debug(str); + } catch (IOException e) { + e.printStackTrace(); + } + } + +}