The @Resource annotation in Eclipse-Spring is used to report an error
1. Problems arise
2. The cause of the problem
@ the Resource is equivalent to the applicationContext. GetBean method, is the annotation – API. The class in the jar package, only support is jdk1.6 annotations, and their default is jdk1.5 (pictured) of the project, so the JDK version because the project is too low, there is an error.
3. Solutions
1. Place the cursor on the project — right click — find Build Path — and then go to Configure Build Path (select)
.
> Find the Java Bulib Path — Libraries — Select the default JRE System Library[J2SE-1.5] — double-click — check Workspace Default JRE (JRE 1.8.0_121)* (this will work if you change to the latest)*.
the default format:
to this format:
4, successfully solved the
modification is done, another to write @ Resource annotation automatically prompts, and there is no error