首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Spring注解使用异常的总结

2012-09-05 
Spring注解使用错误的总结错误一 本身类是new出来的,不是通过spring注入的错误二配置文件没有加入 beans

Spring注解使用错误的总结
错误一 本身类是new出来的,不是通过spring注入的
错误二  配置文件没有加入 <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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

错误三 配置文件没有 <context:component-scan base-package="com" />

错误四 配置文件没有加 <context:annotation-config/> (不过后来的测试发现加不加都可以)

主要发现还是配置的问题

热点排行