java - 当我在 Eclipse 中构建我的 Spring Boot 应用程序时得到一个期望
问题描述
这是代码
package com.letsstartcoding.springbootrestapiexample;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
@SpringBootApplication
@EnableJpaAuditing
public class EmployeeApplication {
public static void main(String[] args) {
SpringApplication.run(EmployeeApplication.class, args);
}
}
这是我运行上面的特定代码时发生的异常。任何帮助将不胜感激
Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getUrls(DefaultRestartInitializer.java:93)
at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getInitialUrls(DefaultRestartInitializer.java:56)
at org.springframework.boot.devtools.restart.Restarter.<init>(Restarter.java:140)
at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:546)
at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationStartingEvent(RestartApplicationListener.java:67)
at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationEvent(RestartApplicationListener.java:45)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:69)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:292)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.letsstartcoding.springbootrestapiexample.EmployeeApplication.main(EmployeeApplication.java:11)
解决方案
这可能是 String Boot 迁移到 JDK 9 的问题。 Spring Boot Dev Tools v1.5 is not compatible with Java 9 per this bug。该问题已在 Spring Boot 2.0.0.M5 中修复。
检查Spring Boot 插件故障部分。
推荐阅读
- python - 如何使用 pygsheets 将 URL 列表写入谷歌驱动器电子表格
- python - Visual Studio 不使用当前的 PTVSD 版本
- vb.net - 根据图案组合线条
- c# - 如何用 ToString() 格式化 Duration?
- sql - SQL query to do this
- python - 无法使用 selenium python 切换多选下拉菜单
- r - Create leaflet map with mainland country and overseas territories grouped together
- python - Pandas groupby rank date time
- c# - 面临将 XML 转换为 Object 的问题
- reactjs - 使用 CDN 反应过渡组