Skip to content

Gradle project error – java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication

This is my main application code:


import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

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

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.lang.ClassLoader.loadClass(
    at sun.misc.Launcher$AppClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    ... 6 more

Process finished with exit code 1

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!



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.

Please refer this for more information:

Hope this solves your problem.

User contributions licensed under: CC BY-SA
5 People found this is helpful