When using JUnit in Spring there are several features added that many developers are not aware of.
First, if you are including the Spring Context in your tests, it becomes an Integration Test, no longer a Unit Test.
1. Default Searching of Context File(s)To instruct Spring to load beans for the tests in the class, we annotate the class with
1a. No File Specified
@ContextConfiguration– with no parameters, (by Default) looks for the config file as the same name as the class with the suffix “
-context.xml“. For example,
Is equivalent to