context:annotation-config 错误解决办法

来源:互联网 发布:宁波知豆电动汽车公司 编辑:程序博客网 时间:2024/06/05 17:58
context:annotation-config 错误解决办法

 今天在整合Spring和Hibernate的时候在配置文件中添加<context:annotation-config />时一直有红色的波浪线在这个代码的下面,后来发现应该xml的头部没有申明context前缀。所以使用下面的spring文件就可以

  1. <beans xmlns="http://www.springframework.org/schema/beans" 
  2.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  3. xmlns:aop="http://www.springframework.org/schema/aop" 
  4.     xmlns:context="http://www.springframework.org/schema/context" 
  5. xmlns:tx="http://www.springframework.org/schema/tx" 
  6.     xsi:schemaLocation="http://www.springframework.org/schema/beans    
  7.       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd   
  8.       http://www.springframework.org/schema/context   
  9.       http://www.springframework.org/schema/context/spring-context-2.5.xsd   
  10.       http://www.springframework.org/schema/aop   
  11.       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd   
  12.       http://www.springframework.org/schema/tx   
  13.       http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> 
  14. <beans/> 

原创粉丝点击