Use Maven to create a WebApp project online a lot of information, not in detail here. After the completion of the creation, it is said to switch to the Dynamic Web project to change to 3.0 version, but I do not locally switch, the online method seems useless, and temporarily useless to this piece. After the SSM framework is set up, let's elaborate on this piece. Today's talk is about the pit for the JUnit unit test that was encountered when building the SSM framework in accordance with a tutorial on the web, because it involved Maven's versioning and never jumped out. It was settled yesterday afternoon. It is possible that other eclipse or other environments will not encounter this problem, but I would like to remind you here. As the following tutorial HTTPS://GITHUB.COM/LIYIFENG1994/SSM build your environment, For the JUnit (4.11) and Spring-test (4.1.7) versions of which unit tests are used, the following JUnit unit test initialization error Initializationerror is ejected during unit testing.
If you want to use Spring-test jar package for unit testing, JUnit needs to be JUNIT4 version above, just replace the spring related version with Spring4 Other version, I replace it here with 4.0.2 version, The unit test can be passed.
PS: Using the SSM framework for unit testing only to feel that "configuration first", a variety of bean objects, SQL configuration, etc. are loaded in the configuration file synchronously loaded well, if you are unfamiliar with the whole process, there is a problem, it is a deep pit.
Maven+spring+junit test to be aware of things