Maven+spring+junit test to be aware of things

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.