Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij "cannot resolve symbol" after installing spring boot

I've recently installed the plugin "spring boot assistant" into my Intellij. When I was trying to run an old java file that I've completed before, a lot of the symbols were displayed as "cannot resolve symbol".

This is what my file looks like. enter image description here

I think this might have something to do with maven, but I dont know how to fix it since there's no errors with running the program before installing spring-boot and maven. I've just started learning spring boot so I'm still unfamiliar with the functions. Please help me.

like image 931
rika_xxx Avatar asked Mar 01 '21 09:03

rika_xxx


People also ask

How do I resolve import error in IntelliJ?

You can try invalidating the cache and restarting IntelliJ, in many cases it will help. After "Invalidate Caches/Restart", you have to wait for re-index when you open any project!

Does IntelliJ IDEA support Spring Boot?

IntelliJ IDEA creates and executes the Spring Boot run configuration.

How to resolve 'cannot resolve symbol string' error in IntelliJ?

Ever since copying a Gradle project from one computer to another I have been getting 'cannot resolve symbol String' and similar messages in IntelliJ. Listed below are steps which *may* fix the problem: Invalidate and refresh the IntelliJ's caches File Menu -> Invalidate Caches / Restart Project SDK selection

Can IntelliJ help with custom properties in Spring Boot?

When we're injecting runtime properties into our Spring applications, we may define bean classes for groups of custom properties. IntelliJ provides help and auto-complete for the built-in properties beans. However, it needs a little help to provide these for custom properties.

How to resolve @springbootapplication cannot resolve error?

Put your mouse over and press ⌥ Option + Enter, then click on Add library... (most of the cases the first option); and if still you see the error, cannot resolve @SpringBootApplication

Why can’t IntelliJ Read my Maven project?

It might be because IntelliJ hasn’t correctly recognised the project as a Maven project. To confirm this, have a look at the pom.xml file icon. If it’s just shown as a normal XML icon like this: Then you’ll need to specifically tell IntelliJ to read the file as a Maven project, by right-clicking the pom.xml file and choosing this option:


2 Answers

Some plugins might mess up with the project settings. First of all, try to invalidate cache: File -> Invalidate Caches / Restart.... Confirm with Invalidate and Restart. It takes a while but is worth a try.

If it doesn't work your SDK is not set: Open File -> Project Structure... and navigate to Project and add a Project SDK and the Project language level you need (you might want to navigate to your SDK saved in the system instead).

enter image description here

It is also worth to try checking up the language levels:

  • File -> Project Structure... and navigate to Modules.

    Check the Language level of each module.

  • File -> Settings and navigate to Build, Execution, Deployment -> Java Compiler.

    Check the Target bytecode version of each module.

like image 96
Nikolas Charalambidis Avatar answered Oct 13 '22 00:10

Nikolas Charalambidis


It seems to have issues with resolving absolutely basic Java stuff - try going into Project Structure -> Project Settings -> Project and check if you have an SDK defined for your project.

like image 1
Dropout Avatar answered Oct 13 '22 00:10

Dropout