导入maven项目后实现类中的@Override注解报错解决方法

导入maven项目后,会发现实现类中的方法不能重写,需要去除@override注解。The method saveUserInfo(String, String, String, int, String, String, String) of type CustomerServiceImpl must override a superclass method。


解决方法:

看一下你的JDK版本是不是1.5,我们需要在pom文件中加入编译插件,然后maven updateProject或者快捷键Alt+F5,即可快捷修复以上问题。这时候你的JDK版本就是1.8了。

原因:JDK1.5版本不支持对接口的实现,在之后版本修复了这个bug。

<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.7.0</version>
				<configuration>
				<source>1.8</source>
				<target>1.8</target>
				</configuration>
			</plugin>

猜你喜欢

转载自blog.csdn.net/weixin_42133396/article/details/80193243