'javax.servlet.http.httpservletrequest cannot be resolved after upgrading spring boot version

Recently I have upgraded the spring boot version of my project from 2.5.3 to 2.5.12 and 2.6.6. In both versions, the same issue appear.

javax.servlet.http.httpservletrequest cannot be resolved

I tried adding the dependency in my pom.xml as below.

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <scope>provided</scope>
</dependency>

However, the other issues came out after solving the issue above.

The import org.springframework.boot.SpringApplication cannot be resolved The import org.springframework.boot.autoconfigure.SpringBootApplication cannot be resolved The import org.springframework.boot.context.properties.EnableConfigurationProperties cannot be resolved

What should I do to fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source