2014-09-02 79 views
-2

運行應用程序時,它拋出下面的錯誤在XML「語境:組件掃描」不工作

The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'. 

但我已經加入xmlns:context和模式也是如此。我也試過用Spring 4.0。 任何人都可以請幫忙嗎?

請參閱完整代碼如下

<?xml version="1.0" encoding="UTF-8"?> 
<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:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" 
    xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" 
    xmlns:util="http://www.springframework.org/schema/util" 

    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd 
     http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 
     http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.2.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd 
     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd"> 
    <context:component-scan base-package="mypack" /> 

</beans> 
+0

可以粘貼整個'的applicationContext .xml'文件好嗎? – christopher 2014-09-02 19:01:06

+0

也許你忘了發佈錯誤? – 2014-09-02 19:01:12

+0

<?xml version =「1.0」encoding =「UTF-8」?> 2014-09-02 19:04:16

回答

3

它工作時,我改變了XML文件象下面這樣:

<beans xmlns="springframework.org/schema/beans"; 
    xmlns:xsi="w3.org/2001/XMLSchema-instance"; 
    xmlns:aop="springframework.org/schema/aop"; 
    xmlns:context="springframework.org/schema/context"; 
    xmlns:flow="springframework.org/schema/webflow-config"; 
    xmlns:lang="springframework.org/schema/lang"; 
    xmlns:p="springframework.org/schema/p"; 
    xmlns:util="springframework.org/schema/util"; 

(與相應的架構)