Gradle项目错误-java.lang.ClassNotFoundException:org.springframework.boot.SpringApplication [英] Gradle project error - java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication

查看:982
本文介绍了Gradle项目错误-java.lang.ClassNotFoundException:org.springframework.boot.SpringApplication的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的主要应用代码:

This is my main application code:

package u.d.dip.rs.app;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;

@EnableWebSecurity
@SpringBootApplication
@ComponentScan(basePackages = "u.d.dip")
@EnableAutoConfiguration
public class DipApplication {
    public static void main(String[] args) {
        SpringApplication.run(DipApplication.class, args);
    }
}

我正在使用gradle构建项目.即使SpringApplication文件已正确导入,我也会遇到以下错误:

I'm using gradle to build the project. Even though SpringApplication file is properly imported I'm getting the following error:

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 6 more

Process finished with exit code 1

当我将鼠标悬停在SpringApplication上时,我会收到gradle消息

I'm getting following gradle message when I hover over SpringApplication

[Gradle: org.springframework.boot:spring-boot:1.5.1.RELEASE] org.springframework.boot public class SpringApplication extends Object

任何帮助将不胜感激. 预先感谢!

Any help would be much appreciated. Thanks in advance!

推荐答案

该错误是由于gradle 3.4出现问题,我已将gradle发行版更改为3.2,现在一切正常.

The error was because of an issue with gradle 3.4 I've changed my gradle distribution to 3.2 and everything is working fine now.

请参阅此以获取更多信息: https://github.com/gradle/gradle/issues/1335

Please refer this for more information: https://github.com/gradle/gradle/issues/1335

希望这可以解决您的问题.

Hope this solves your problem.

这篇关于Gradle项目错误-java.lang.ClassNotFoundException:org.springframework.boot.SpringApplication的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆