'作为Spring Boot App运行'在STS,但"网页不可用"在浏览器中

时间:2016-01-30 19:26:05

标签: spring spring-boot

就像标题所说,我右键单击spring boot项目和Run as Spring Boot App。这就是我在STS的控制台窗口中看到的:

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.3.2.RELEASE)

2016-01-30 21:06:29.124  INFO 6584 --- [           main] l.IssueManagerApplication                : Starting IssueManagerApplication on LVN with PID 6584 (E:\_WORKSPACE\SPRING_BOOT\issue-manager\target\classes started by Le in E:\_WORKSPACE\SPRING_BOOT\issue-manager)
2016-01-30 21:06:29.130  INFO 6584 --- [           main] l.IssueManagerApplication                : No active profile set, falling back to default profiles: default
2016-01-30 21:06:29.249  INFO 6584 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@12d575ec: startup date [Sat Jan 30 21:06:29 EET 2016]; root of context hierarchy
2016-01-30 21:06:31.208  INFO 6584 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-01-30 21:06:32.032  INFO 6584 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2016-01-30 21:06:32.077  INFO 6584 --- [           main] l.IssueManagerApplication                : Started IssueManagerApplication in 4.163 seconds (JVM running for 6.548)
2016-01-30 21:06:32.078  INFO 6584 --- [       Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@12d575ec: startup date [Sat Jan 30 21:06:29 EET 2016]; root of context hierarchy
2016-01-30 21:06:32.084  INFO 6584 --- [       Thread-2] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

当我打开localhost:8080时,它只显示一个灰色页面,上面写着"此网页不可用"。显然,服务器根本没有启动或启动,但之后就停止了。

我已尝试运行mvn spring-boot:run,它还会将上述信息与BUILD SUCCESS一起注销,即使没有Ctrl + C也会停止。所以我不知道如何运行我的"你好世界" spring-boot应用程序。

1 个答案:

答案 0 :(得分:0)

我在我的pom.xml中添加了这个问题来解决这个问题:

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

感谢这篇文章: Why my Spring Boot App always shutdown