企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
今天配置完: ~~~ <!-- 自动扫描与装配,包含子包 --> <context:component-scan base-package="cn.itcast.oa"></context:component-scan> ~~~ 这句话之后,validating 我的spring配置文件就一直走不下去了。当时以为是myeclipse卡了,之后去掉了所有的validating。 后来写了个单元测试测试Spring配置的时候,发现报错: columnNumber:54; 元素 "context:component-scan" 的前缀 "context" 未绑定。 看来果然是自动装配与扫描有问题。查了下,貌似是少了context的命名空间的问题: ~~~       <beans xmlns="http://www.springframework.org/schema/beans"     xmlns:context="http://www.springframework.org/schema/context"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"     xsi:schemaLocation="             http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd             http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd             http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd              http://www.springframework.org/schema/context                   http://www.springframework.org/schema/context/spring-context-2.5.xsd             "> ~~~ 加上带红色字体的部分,成功run过去了。 顺便说下xml中各种版本,如果没有的话,会自动使用最新版本。