Recently in the spring in action this book, set up the environment on Ubuntu to start development, did not expect to do the first example of chapter two encountered a mistake.
First I built a test class Cdplayertest in the controller package under the Src/main/java folder, and then prompted that Contextconfiguration and Springjunit4classrunner could not be resolved. I chose Add library org.springframework to classpath according to the idea hint.
And everything seems to be going well and feeling good
Then started to open the happy run cdplayertest, the result was surprised, Nosuchmethoderror. And then started my search journey.
Search results are mostly like this, Mengmengdongdong, continue to explore. Also find spring in action source code to see.
Finally settled. Build the Cdplayertest under the Test/java folder and remove the Org.springframework dependency from the Pom.xml
Re-run cdplayertest, fix it. Summing up the sense of the key is that the test file was built in the wrong location, resulting in the inability to parse the two annotation, and then mistakenly added the wrong org.springframework to the classpath, resulting in a conflict run error.
The mood is really comfortable, continue to study.
Solved:spring Junit Test Nosuchmethoderror