spring--Junit integration

Junit integration:
jar package:
5 basic packages, plus a test package:
spring-framework-3.2.0.RELEASE\libs-->spring-test-3.2.0.RELEASE.jar
@RunWith(SpringJUnit4ClassRunner.class) will spring Integrate with junit
@ContextConfiguration(locations="classpath:applicationContext.xml") loads the configuration file under the classpath. The above two annotations are added to the class, and the next one is added to the @Autowired
inside the class to automatically inject the service layer, so that there is no need for xml scanning. private UserService userService;

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326555569&siteId=291194637