Spring Boot:重新启动器未初始化

RKA*_*RKA 6 java spring spring-boot

当春季启动版本为1.5.3.RELEASE时,启动应用程序时出现以下错误

堆栈跟踪:

java.lang.IllegalStateException: Restarter has not been initialized
    at org.springframework.util.Assert.state(Assert.java:392) ~[spring-core-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.boot.devtools.restart.Restarter.getInstance(Restarter.java:563) ~[spring-boot-devtools-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationPreparedEvent(RestartApplicationListener.java:75) ~[spring-boot-devtools-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationEvent(RestartApplicationListener.java:48) ~[spring-boot-devtools-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:85) ~[spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:66) ~[spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:367) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
    at com.*.SpringBootWebApplication.main(SpringBootWebApplication.java:17) [classes/:na]
Run Code Online (Sandbox Code Playgroud)

注意:当版本更改为1.4.2.RELEASE时,它可以正常工作,并且没有引发上述异常

Shi*_*ant 8

Problem exist due to version of artifact. Remove the version in
**org.springframework.boot
spring-boot-devtools** in pom.xml

For Maven inside pom.xml
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
    </dependency>
<dependencies>

For Gradle inside build.gradle file
dependencies {
    compile "org.springframework.boot:spring-boot-devtools" 
}
Run Code Online (Sandbox Code Playgroud)