天天看点

使用spring过程中遇到:小问题

问题1:
- cvc-elt.1: Cannot find the declaration of element 'beans'.
这个是由于spring的jar包与applicationContext.xml中xsd的 版本不同 造成的。我刚开始的配置是这样的:
<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:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/context
 http://www.springframework.org/schema/context/spring-context.xsd
         http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx.xsd
         http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop.xsd">
                
schemaLocation中的文件并没有相应的版本号导致出错,解决方案就是加上相应的版本号:如
                

转载于:https://my.oschina.net/u/1011659/blog/203770