[英]Spring Boot application suddenly stops after outputing logo and version on Eclipse
When I execute Run As -> Java application my Spring Boot application class on Eclipse, I get Spring Boot logo and version in logs but it halts and stops after few seconds:当我在 Eclipse 上执行 Run As -> Java application my Spring Boot application class 时,我在日志中得到 Spring Boot 徽标和版本,但它会在几秒钟后暂停并停止:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
Spring version: 1.5.9.RELEASE
There are no errors in console.控制台中没有错误。
Tried but didn't help:尝试但没有帮助:
gradle clean
, build
, eclipse
from command line gradle clean
, build
, eclipse
从命令行 Tried solutions from related SO threads:来自相关 SO 线程的尝试解决方案:
Also:还:
gradle bootRun
, it runs smoothly.gradle bootRun
从命令行运行应用程序时,它运行顺利。 Why does it happen?为什么会这样? How to solve it?
如何解决?
Deleted logback.xml
from src/main/resources
and logback-test.xml
from src/test/resources
and it worked.从
src/main/resources
中删除logback.xml
,从src/test/resources
中删除了logback-test.xml
,它起作用了。
In my case It was fixed when added the spring boot web dependency在我的例子中,它在添加 spring boot web 依赖项时得到修复
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Spring Boot is still working, just there is no output in the console after logo. Spring Boot 还在工作,只是在 logo 之后控制台没有任何输出。 Server will startup if there are no other issues.
如果没有其他问题,服务器将启动。
In my case Spring Boot console stopped logging after i renamed application.properties into core.properties (that file is referred in logback.xml)在我的例子中,Spring Boot 控制台在我将 application.properties 重命名为 core.properties 后停止记录(该文件在 logback.xml 中引用)
<define name="internalFile" class="ch.qos.logback.core.property.ResourceExistsPropertyDefiner">
<resource>application.properties</resource>
</define>
After updating the resource tag, console output was back.更新资源标签后,控制台输出又回来了。
in my case the reason was that I was using an alpha release of sl4j.在我的例子中,原因是我使用的是 sl4j 的 alpha 版本。 When i replaced it with an older one I was able to start the spring boot application.
当我用旧的替换它时,我能够启动 spring boot 应用程序。
If the answers above are not satisfactory the issue in my case was that I was including dependency with its own slf4j setup, that got in clash with Spring Boot's one (old vs. new).如果上面的答案不令人满意,在我的案例中,问题是我将依赖包含在它自己的 slf4j 设置中,这与 Spring Boot 的设置(旧与新)发生冲突。
The problem was that the dependency was accidentally built as fat-jar.问题是依赖项被意外地构建为 fat-jar。
I had this issue from upgrading the slf4j-api
dependency from 1.X
to 2.0.6
.我在将
slf4j-api
依赖项从1.X
升级到2.0.6
时遇到了这个问题。 We were able to resolve by adding slf4j-simple:2.0.6
dependency as well.我们也能够通过添加
slf4j-simple:2.0.6
依赖项来解决。 The slf4j patch notes for version 2.0
go over this topic here .有关此主题的
2.0
版 slf4j 补丁说明 go 在这里。 Spring hanging on the logo appears to be an additional side effect. Spring 挂在徽标上似乎是一个额外的副作用。
slf4j-api version ![]() |
slf4j-simple version ![]() |
Result![]() |
Explanation![]() |
---|---|---|---|
2.0.x ![]() |
2.0.x ![]() |
OK![]() |
Same version for slf4j-api and provider ![]() |
1.7.x ![]() |
2.0.x ![]() |
no bindings can be found warning message![]() |
2.0.x providers do not act as 1.7.x/1.6.x compatible bindings ![]() |
2.0.x ![]() |
1.7.x ![]() |
no providers can be found warning message![]() |
slf4j-api 2.0.x will no longer search for StaticLoggerBinding ![]() |
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.