解决Spring中使用context:component-scan命名空间配置错误

** nested exception is org.xml.sax.SAXParseException; lineNumber: 16; columnNumber: 74; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ‘context:component-scan‘ 的声明。

原因:Spring命名空间配置错误,缺少相应的spring-bean。
解决:
<?xml version="1.0" encoding="UTF-8"?>
<beans**
xmlns="http://www.springframework.org/schema/beans"**
xmlns:amq="http://activemq.apache.org/schema/core"
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-3.0.xsd

http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd"&gt;

原文地址:http://blog.51cto.com/59465168/2071954

时间: 2024-08-28 23:05:27

解决Spring中使用context:component-scan命名空间配置错误的相关文章

spring中使用parent属性来减少配置

在基于spring框架开发的项目中,如果有多个bean都是一个类的实力,如配置多个数据源时,大部分配置的属性都一样,只有少部分不一样,经常是copy上一个的定义,然后修改不一样的地方.其实spring bean定义也可以和对象一样进行继承. 示例如下:  <bean id="testBeanParent"  abstract="true"  class="com.wanzheng90.bean.TestBean">         &

关于spring中使用多个quatz配置文件配置计划任务时,只有其中一个文件的任务有效的问题

关于spring中使用多个quatz配置文件配置计划任务时,只有其中一个文件的任务有效的问题 问题描述 工作中用到了spring与quatz来实现定时器触发一些计划任务,原本都写在一个配置文件里.后来将不同业务逻辑拆分成两个文件后,发现每次spring容器启动后,只有其中一个文件中配置的计划任务有再执行,另一个则没有. 解决方案 通过google在stackoverflow上找到了解决方案,其实原因很简单.在spring容器中配置了多个Scheduler的情况下,必须给每个Scheduler指定

Spring AOP报错处理 Can not set field to $Proxy 在spring中使用事物或AOP遇到的错误

[转] 解决方法: http://forum.springsource.org/showthread.php?85016-IllegalArgumentException-with-ApplicationContextAware-Proxy 在配置文件中加入proxy-target-class="true" <tx:annotation-driven transaction-manager="transactionManager" proxy-target-c

关于Spring中的&lt;context:annotation-config/&gt;配置

当我们需要使用BeanPostProcessor时,直接在Spring配置文件中定义这些Bean显得比较笨拙,例如: 使用@Autowired注解,必须事先在Spring容器中声明AutowiredAnnotationBeanPostProcessor的Bean: <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor "/> 使用 @Req

Spring中的&lt;context:annotation-config/&gt;配置

当我们需要使用BeanPostProcessor时,直接在Spring配置文件中定义这些Bean显得比较笨拙,例如: 使用@Autowired注解,必须事先在Spring容器中声明AutowiredAnnotationBeanPostProcessor的Bean: <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor "/> 使用 @Req

关于Spring中的&lt;context:annotation-config/&gt;配置(开启注解)

当我们需要使用BeanPostProcessor时,直接在Spring配置文件中定义这些Bean显得比较笨拙,例如: 使用@Autowired注解,必须事先在Spring容器中声明AutowiredAnnotationBeanPostProcessor的Bean: <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor "/> 使用 @Req

Spring中的AOP注解方式和配置方式

今天学习了下spring中的切面编程:结合之前看过的视频.整合一下思路: 基本类: 接口: public interface ArithmeticCalculator { int add(int i, int j); int sub(int i, int j); int mul(int i, int j); int div(int i, int j); } 接口的实现: import org.springframework.stereotype.Component; @Component("ar

spring 中常用的两种事务配置方式以及事务的传播性、隔离级别

转载:http://blog.csdn.net/qh_java/article/details/51811533 一.注解式事务 1.注解式事务在平时的开发中使用的挺多,工作的两个公司中看到很多项目使用了这种方式,下面看看具体的配置demo. 2.事务配置实例 (1).spring+mybatis 事务配置 [html] view plain copy <!-- 定义事务管理器 --> <bean id="transactionManager" class="

Spring中的context:annotation-config作用

<context:annotation-config/> 他的作用是隐式地向 Spring 容器注册 AutowiredAnnotationBeanPostProcessor.CommonAnnotationBeanPostProcessor. PersistenceAnnotationBeanPostProcessor. RequiredAnnotationBeanPostProcessor 这4个BeanPostProcessor. 如果想使用@ Resource .@ PostConst