Spring Boot 2.X 实战教程(10)开发人员工具

10. SpringApplication

SpringApplication类提供了一个方便的方式来引导该从开始Spring应用程序main()的方法。

10.1启动失败

如果您的应用程序无法启动,例如,如果您在端口上启动Web应用程序8080并且该端口已在使用中,您应该会看到类似于以下消息的内容:

***************************

APPLICATION FAILED TO START

***************************

Description:

Embedded servlet container failed to start. Port 8080 was already in use.

Action:

Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.

为此,需要为

org.springframework.boot.autoconfigure.logging.conditionEvaluationReportLoggingListener

启用debug属性或启用DEBUG日志记录。

例如,如果您使用运行应用程序java -jar,则可以debug按如下方式启用该属性:

$ java -jar myproject-0.0.1-SNAPSHOT.jar --debug

10.2自定义横幅

可以通过向banner.txt类路径添加文件或将spring.banner.location属性设置为此类文件的位置来更改启动时打印的横幅。

横幅可以在http://patorjk.com/software/taag/网站免费制作。

如有疑问,请观看视频:https://ke.qq.com/course/428845

猜你喜欢

转载自www.cnblogs.com/daqiang123/p/11265748.html