我目前正在使用 Spring Hibernate 进行一个项目。
通常,当我使用 Tomcat 部署和运行我的项目时,我会在控制台中看到类似于下图的打印内容:
但是,我当前的构建不再显示 Spring 标志。
我在控制台上收到的输出很简单:
Connected to server
[2017-03-24 01:14:19,058] Artifact Gradle : com.enocom : jddp-112.112.112.war (exploded): Artifact is being deployed, please wait...
[2017-03-24 01:14:19,416] Artifact Gradle : com.enocom : jddp-112.112.112.war (exploded): Artifact is deployed successfully
[2017-03-24 01:14:19,416] Artifact Gradle : com.enocom : jddp-112.112.112.war (exploded): Deploy took 358 milliseconds
24-Mar-2017 13:14:28.886 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 8.5\webapps\manager
24-Mar-2017 13:14:28.949 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Program Files\Apache Software Foundation\Tomcat 8.5\webapps\manager has finished in 63 ms
没有报错信息,服务器已连接,部署了war文件。但是为什么Spring标志不见了,项目运行正常吗?这可能是什么原因造成的?
谢谢。
最佳答案
检查属性中 spring.main.banner-mode
的值。您可以使用 System.getProperty("prop")/System.env("prop")
或仅通过将 Actuator
依赖项添加到 POM< 来打印该属性
您将能够看到 /env
端点中的所有属性。
有 3 个可能的值 from the documentation here .
- 控制台
- 日志
- 关闭
如果值为 off
,则不会打印横幅。
最简单的方法是手动将值设置为 console/log
并查看它是否被打印。
关于java - Spring 不能正常工作但没有错误信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43006738/