pom.xml配置
vst_order src/main/config *.properties src/main/java **/*.xml false src/test/config src/test/java maven-compiler-plugin 3.1 UTF-8 org.apache.maven.plugins maven-war-plugin 2.2 true org.apache.maven.plugins maven-surefire-plugin true java目录结构
test目录下配置config目录和java目录,将所有相关配置文件放到config目录中
java代码书写
private LineProdPackageGroupService lineProdPackageGroupServiceImpl; @Before public void prepare() { String[] contextPaths = {"applicationContext-vst-order-beans.xml"}; applicationContext = new ClassPathXmlApplicationContext(contextPaths); if (this.applicationContext != null) { this.lineProdPackageGroupServiceImpl = (LineProdPackageGroupService) this.applicationContext .getBean("lineProdPackageGroupServiceImpl"); } } @Test public void testCreateProduct(){ this.lineProdPackageGroupServiceImpl.initTrafficBizInfo(null);}