spring - How to add an xml of a dependant project in eclipse -
i having applicationcontext.xml of existing project. created new junit -java project in kept previous project dependent project. created xml -applictioncontextjunit.xml junit project.the question is- how can reuse existing applicationcontext.xml in new xml
this junit class entry-
@runwith(springjunit4classrunner.class) @contextconfiguration("classpath:applicationcontextjunit.xml") public class testjunit { private customerservice cust; }
this applictioncontextjunit.xml--
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <import resource="/spring-mvc/src/main/java/applicationcontext.xml"/> <bean id="junit" class="com.junit.test.testjunit"> <property name="cust" ref="cust"/> </bean> </beans>
this applicationcontext.xml of first project--
<bean id="cust" class="com.krams.tutorial.dao.customerservice"> <property name="firstname" value="xxx"/> <property name="lastname" value="yyy"/></bean>
when running testunit, giving exception--
offending resource: class path resource [applicationcontextjunit.xml]; nested exception org.springframework.beans.factory.beandefinitionstoreexception: ioexception parsing xml document url [file:/e:/eclipse-ws/junit-test/bin/spring-mvc/src/main/java/applicationcontext.xml]; nested exception java.io.filenotfoundexception: e:\eclipse-ws\junit-test\bin\spring-mvc\src\main\java\applicationcontext.xml (the system cannot find path specified)
this classpath entry--
<classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.jre_container/org.eclipse.jdt.internal.debug.ui.launcher.standardvmtype/javase-1.7"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.junit_container/4"/> <classpathentry combineaccessrules="false" kind="src" path="/spring-mvc"/> <classpathentry kind="output" path="bin"/>
spring-mvc first project. , location of applicationcontext.xml spring-mvc\src\main\java\applicationcontext.xml
but still searching applicationcontext.xml in jnuit project how make project identify correct path of applicationcontext.xml?? in advance
Comments
Post a Comment