4
我試圖在測試用例中使用web.xml。但是,我不能......Junit測試用例,如何讀取web.xml
@ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/web.xml",
"/integration/restful/*.xml"}
public class RestfulTest { }
錯誤消息:
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://java.sun.com/xml/ns/javaee] Offending resource: URL [file:src/main/webapp/WEB-INF/web.xml]
web.xml文件的標題:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
我能做些什麼?