Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ: Cannot resolve symbol 'springframework'

I'm trying to start my first project with Spring. I use IntelliJ idea and I'm kind of new to it too. But anyways, I followed the step written on the Jetbrains website and I don't know what I have done wrong, but I got a lot of errors on the first to files that are created by default.

BloomBookingApplcation.java

package com.bloombooking;  import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;  @SpringBootApplication public class BloomBookingApplication {      public static void main(String[] args) {         SpringApplication.run(BloomBookingApplication.class, args);     } }  Error:(3, 12) Cannot resolve symbol 'springframework' Error:(4, 12) Cannot resolve symbol 'springframework' Error:(6, 2) Cannot resolve symbol 'SpringBootApplication' Warning:(7, 1) Access can be packageLocal Error:(9, 26) Cannot resolve symbol 'String' Error:(10, 3) Cannot resolve symbol 'SpringApplication' 

Maybe I'm stupid but I don't know which step I've missed...

How can I fix this?

I have found the way to add spring with the quickfix button.

But now I have got new errors I don't understand why... I should maybe download it directly and put the libraries one by one maybe?

Error:(3, 28) Cannot resolve symbol 'boot' Error:(4, 28) Cannot resolve symbol 'boot' Error:(6, 2) Cannot resolve symbol 'SpringBootApplication' Warning:(7, 1) Access can be packageLocal Error:(9, 26) Cannot resolve symbol 'String' Error:(10, 3) Cannot resolve symbol 'SpringApplication' 

Or maybe it's my IntelliJ idea which isn't configured right since I don't have any completion anywhere and I can't create packages...

like image 392
Antoine Avatar asked Jun 12 '16 12:06

Antoine


People also ask

What does Cannot resolve symbol mean in Java?

The cannot find symbol error, also found under the names of symbol not found and cannot resolve symbol , is a Java compile-time error which emerges whenever there is an identifier in the source code which the compiler is unable to work out what it refers to.


2 Answers

enter image description here

Click on refresh button .Maven may not be able to sync properly

like image 84
Vinayak Shedgeri Avatar answered Sep 21 '22 20:09

Vinayak Shedgeri


I had the same problem, and this is how it worked for me:

On the source root directory -> right click -> Add Framework Support.

A window will open with different categories, such as Java EE, JBoss etc. Go to 'Spring' category. Then, download the pack of libraries that you need (I used 'Spring MVC').

like image 31
MrBlueSky Avatar answered Sep 17 '22 20:09

MrBlueSky