Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring @ContextConfiguration how to put the right location for the xml
    primarykey
    data
    text
    <p>In our project we are writting a test to check if the controller returns the right modelview</p> <pre><code>@Test public void controllerReturnsModelToOverzichtpage() { ModelAndView modelView = new ModelAndView(); KlasoverzichtController controller = new KlasoverzichtController(); modelView = controller.showOverzicht(); assertEquals("Klasoverzichtcontroller returns the wrong view ", modelView.getViewName(), "overzicht"); } </code></pre> <p>This returns the exception null.</p> <p>We are now configuring the @contextconfiguration but we don't know how to load the right xml who is located at src\main\webapp\root\WEB-INF\root-context.xml</p> <pre><code>@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class TestOverzichtSenario{ .... </code></pre> <p><a href="http://static.springsource.org/spring/docs/current/spring-framework-reference/htmlsingle/spring-framework-reference.html#testcontext-ctx-management" rel="noreferrer" title="Spring @context... ">This documentation isn't clear enough to understand</a></p> <p>Any suggestion on how to make sure the contextannotation loads the right xml?</p> <p><strong>Edit v2</strong></p> <p>I copied the configuration .xml files from the webINF folder to </p> <pre><code>src\main\resources\be\..a bunch of folders..\configuration\*.xml </code></pre> <p>and changed the web.xml in webinf to </p> <pre><code>&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt; classpath*:configuration/root-context.xml classpath*:configuration/applicationContext-security.xml &lt;/param-value&gt; </code></pre> <p>and now get the error </p> <pre><code>org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341) org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93) org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) javax.servlet.GenericServlet.init(GenericServlet.java:212) com.springsource.insight.collection.tcserver.request.HttpRequestOperationCollectionValve.invoke(HttpRequestOperationCollectionValve.java:80) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:379) java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) java.lang.Thread.run(Unknown Source) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload