您的位置:首页 > 编程语言 > Java开发

Spring_元素 "context:annotation-config" 的前缀 "context" 未绑定

2016-03-24 22:12 666 查看
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
<u>xmlns:context="http://www.springframework.org/schema/context"</u>

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd <u>http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd </u> 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">
<!-- <bean id="animal" class="ioc.Animal">
<property name="animalType">
<value>Dog</value>
</property>
<property name="moveMode">
<value>fly</value>
</property>
</bean> -->

<context:annotation-config/>
<bean id="movePrinter" class="ioc.ScreenPrinter"></bean>
<bean id="animal" class="ioc.Animal">
<!-- <property name="printer" ref="movePrinter"></property> -->
<!-- 1、自动装配 -->
<!-- 2、使用注解来自动装配 -->

<property name="animalType">
<value>Dog</value>
</property>
<property name="moveMode">
<value>fly</value>
</property>
</bean>

<!-- 	<bean id="animal" class="ioc.Animal">
<constructor-arg index="0" type="java.lang.String" value="Bird"></constructor-arg>
<constructor-arg index="1" type="java.lang.String" value="fly"></constructor-arg>
</bean> -->
</beans>
下划线标注的行很重要,解决问题的关键!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  javaEE Spring