org.springframework.web.servlet.DispatcherServlet’ is not assignable to javax.servlet.Servlet 报红
报错样式:
问题:
大概率是导入Maven中spring-webmvc的版本过高,我的是使用 6.0.11
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>6.0.11</version>
</dependency>
解决:
改成低版本的就可以了
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.3.9</version>
</dependency>