SpringMVC Spring @override报错,注释报错

@override注释在jdk1.5环境下只能用于对继承的类的方法的重写,而不能用于对实现的接口中的方法的实现。

解决办法:
1,在右键项目选择Properties-->java Compiler-->Compiler Compliance Level-->将jdk设置为6.0.
2,如果还不行就查看一下Windows-->Preferences-->tomcat-->jdk-->tomcat JDK home ,选择与项目一直的jdk。

开发环境要注意项目里的jdk和tomcat JDK要匹配

另外有时候会报这种错误:Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 或者bad version number in .class file unable to load class,也是由于项目变量中的jdk版本和Compiler Compliance Level中jdk版本不一致所一致

黑色头发:http://heisetoufa.iteye.com/

猜你喜欢

转载自heisetoufa.iteye.com/blog/1058217