旧版本的spring boot无法在Java 11上启动

旧版本的spring boot无法在Java 11上启动,java,spring-boot,Java,Spring Boot,我使用的是spring boot应用程序的1.4.1.0版本。对于Java8,一切都正常。然而,当我将java版本更新到11时,我无法使用命令mvn clean spring boot:run运行应用程序。同时我可以成功打包(使用mvn包)。当我将java版本设置为8时,它又可以正常工作了 [main] ERROR o.s.boot.SpringApplication - Application startup failed java.lang.IllegalStateException

我使用的是spring boot应用程序的1.4.1.0版本。对于Java8,一切都正常。然而,当我将java版本更新到11时,我无法使用命令
mvn clean spring boot:run
运行应用程序。同时我可以成功打包(使用mvn包)。当我将java版本设置为8时,它又可以正常工作了

[main] ERROR o.s.boot.SpringApplication - Application startup failed
    java.lang.IllegalStateException: Restarter has not been initialized
        at org.springframework.util.Assert.state(Assert.java:392)
        at org.springframework.boot.devtools.restart.Restarter.getInstance(Restarter.java:545)
        at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationEvent(RestartApplicationListener.java:48)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121)
        at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:85)
        at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:66)
        at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:367)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175)
        at com.myapp.Application.main(Application.java:24)

我可以理解,较新版本的Spring可能需要较新版本的Java。但不清楚为什么较旧的spring boot不能在较新的java版本上运行。

您正在使用的spring boot版本是在2016年9月发布的,远远早于2018年9月java 11发布。我建议您更新到Spring Boot的最新版本,该版本目前正在运行

请让我知道这是否解决了您的问题;否则,我们将对其进行进一步调试。

默认情况下,Spring Boot 1.4.1.RELEASE需要Java 7到Java 8(强烈推荐)以及Spring Framework 4.3.3.RELEASE或更高版本。如果您想在SpringBoot的某些版本中使用Java11,建议使用最新版本,那么您应该升级您的项目

尽管您可以将Spring Boot与Java67一起使用,但如果可能,我们通常推荐Java8


开始使用
java11
的springboot版本是
2.1.1
,您可以使用任何版本

Spring Boot 2.1.1.RELEASE需要Java8,并且兼容到Java11(包括在内)


2.2.0实际上是spring boot的最新版本。它只是还没有上传到maven存储库。