banner 配置,无关紧要的配置,就是我们在启动项目时显示的 log ,如下:
自定义横幅
我们可以通过向banner.txt类路径添加文件或将spring.banner.location属性设置为此类文件的位置来更改启动时打印的横幅。
通过向 banner.txt 类路径添加文件:我们在 resources 目录下自定义添加 banner.txt 文件,内容自定义,小编随便定义的 :hello spring boot !!!
启动项目如下:
我们也可以使用第三方网站:http://patorjk.com/software/taag/ 进行内容编辑:
启动项目:
禁用横幅
我们需要在启动类进行修改:
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication build = new SpringApplicationBuilder(DemoApplication.class).build();
build.setBannerMode(Banner.Mode.OFF);
build.run(args);
// SpringApplication.run(DemoApplication.class, args);
}
}
启动项目:
关于 Spring Boot 中 banner 配置小编就介绍到这里!!!