Spring Boot应用程序启动后立即关闭

标签 spring windows spring-mvc intellij-idea spring-boot

我目前正在从事一个包含 Spring 框架的项目。一切都作为方面工作,但有一个问题。当我尝试在笔记本电脑上启动我的应用程序时,它会在启动后立即关闭。 它在所有其他机器上都能正常工作,所以这个问题只出现在我的笔记本电脑上。

也许您知道是什么导致了这个问题?我正在使用 IntelliJ,但我还没有找到解决这个问题的方法。 PC 规范

  • 笔记本电脑是 AsusN550JK(修改了 RAM 和 SSD)
  • 英特尔酷睿 i7-4700HQ CPU@2.4 GHz
  • 16 GB 内存
  • 500 GB SSD 三星 EVO 840
  • 1 TB 硬盘
  • 64 位操作系统 - Windows 10

控制台输出

Exclusions:
-----------

    None


Unconditional classes:
----------------------

    org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration

    org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration

    org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration

    org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration



2017-04-22 21:24:15.756  INFO 6300 --- [           main] com.objectbay.test.me.Application        : Started Application in 8.012 seconds (JVM running for 9.251)
2017-04-22 21:24:15.758  INFO 6300 --- [       Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@6fb0d3ed: startup date [Sat Apr 22 21:24:08 CEST 2017]; root of context hierarchy
2017-04-22 21:24:15.763  INFO 6300 --- [       Thread-3] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
2017-04-22 21:24:15.764  INFO 6300 --- [       Thread-3] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-04-22 21:24:15.765  INFO 6300 --- [       Thread-3] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2017-04-22 21:24:15.771 DEBUG 6300 --- [       Thread-3] org.hibernate.SQL                        : drop table person if exists
2017-04-22 21:24:15.782  INFO 6300 --- [       Thread-3] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete

Process finished with exit code 0

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.springframework</groupId>
    <artifactId>gs-accessing-data-rest</artifactId>
    <version>0.1.0</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.2.RELEASE</version>
    </parent>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>1.0.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>1.0.0.Final</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>
</project>

在我的机器上无法运行的完整示例 Spring Guide Rest example

控制台 - 更新依赖项后的日志 LOG after Updating Dependencies

最佳答案

添加这个依赖:

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

关于Spring Boot应用程序启动后立即关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43562170/

相关文章:

java - Paypal MassPayout 出现 403 错误

Python ctypes 和没有足够的参数(缺少 4 个字节)

windows - 如何从命令提示符打开 Visual Studio 解决方案文件

java - Spring MVC。渲染布局

java - Spring Boot - 如何为指定根中的多个路由提供一个静态 html 文件

java - 如何防止 Controller 方法在 Chrome 浏览器的 Spring Boot 中运行两次?

java - 如何在保持缓存自动配置的同时添加自定义@Cacheable缓存?

java - 将 Windows 预期批处理转换为 OSX 批处理

java - `servlet-context.xml` 、 `root-context.xml` 和 `web.xml` 的预期用途是什么?

java - Spring Boot - 来自休息 Controller 接口(interface)的休息客户端