首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring Boot App在spring-boot-starter-parent版本2.0.1.RELEASE下立即关闭

Spring Boot App在spring-boot-starter-parent版本2.0.1.RELEASE下立即关闭
EN

Stack Overflow用户
提问于 2018-04-16 21:58:14
回答 1查看 690关注 0票数 1

我正在研究JavaBrain的spring启动视频,我遇到了与下面的链接相同的错误。

Why does my Spring Boot App always shutdown immediately after starting?

我已经指定了spring-boot-starter-web的依赖项,但仍然得到错误。我的pom.xml是这样的。问题是,当我将spring-boot-starter-parent的版本改为1.4.2时,一切工作正常(我可以访问localhost:8080)。我想知道为什么会发生这种情况,我可以做些什么来使2.0.1.RELEASE版本正常工作。

代码语言:javascript
复制
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.1.RELEASE</version>
  </parent>

  <dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
  </dependencies>

代码如下所示:

代码语言:javascript
复制
@SpringBootApplication
public class CourseApiApp {

    public static void main(String[] args) {
        SpringApplication.run(CourseApiApp.class, args);

    }

}

输出:

代码语言:javascript
复制
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.1.RELEASE)

2018-04-16 21:42:07.576  INFO 8976 --- [           main] org.kouchibin.web.CourseApiApp           : Starting CourseApiApp on SAI with PID 8976 (C:\Users\86660\Documents\workspace-sts\course-api\target\classes started by kcb in C:\Users\86660\Documents\workspace-sts\course-api)
2018-04-16 21:42:07.583  INFO 8976 --- [           main] org.kouchibin.web.CourseApiApp           : No active profile set, falling back to default profiles: default
2018-04-16 21:42:07.670  INFO 8976 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@4c40b76e: startup date [Mon Apr 16 21:42:07 CST 2018]; root of context hierarchy
2018-04-16 21:42:08.971  INFO 8976 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-04-16 21:42:08.990  INFO 8976 --- [           main] org.kouchibin.web.CourseApiApp           : Started CourseApiApp in 1.976 seconds (JVM running for 2.624)
2018-04-16 21:42:08.997  INFO 8976 --- [       Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@4c40b76e: startup date [Mon Apr 16 21:42:07 CST 2018]; root of context hierarchy
2018-04-16 21:42:09.000  INFO 8976 --- [       Thread-2] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
EN

回答 1

Stack Overflow用户

发布于 2018-04-16 23:17:58

我已经解决了这个问题。当我手动使用mvn compile时,没有单击eclipse中的RUN按钮,而是显示了更多详细信息,其中一些依赖项无法解决。因此,我在本地存储库中检查了这些依赖项。问题是有些依赖项没有完全下载(带有".inprogress“后缀)。因此,解决此问题的方法是删除所有这些被破坏的依赖项,并重新编译应用程序,这将再次下载依赖项。我猜这个问题很可能发生在中国,由于长城防火墙,到maven存储库的连接不稳定。1.4.2.RELEASE之所以能工作,很简单,因为所有的依赖项都是偶然下载成功的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49859124

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档