我正在尝试实现一个应用程序横幅,在我们的应用程序启动时打印版本和其他信息。我尝试过实现SmartLifecycle和ApplicationListener,但没有成功。
回调方法永远不会被调用,横幅也不会打印。我做错了什么?
public class Banner implements ApplicationListener<ContextStartedEvent>
{
private static final Logger log = LoggerFactory.getLogger(Banner.class);
@Override
public void onApplicationEvent(ContextStartedEvent event)
{
log.info("*******************************************************");
log.info("Application v1.8 starting");
log.info("*******************************************************");
}
}发布于 2016-10-03 13:32:03
如果您使用spring,下面的解决方案将适用于您。
使用ASCII art发生器或使用弹簧启动旗发电机;如果您想使用任何“映像”为Spring应用程序生成横幅。
将生成的ASCII字符复制到/src/main/resources/banner.txt
启动spring引导应用程序。
https://stackoverflow.com/questions/29113103
复制相似问题