首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

spring3 注入有关问题

2012-09-17 
spring3 注入问题?xml version1.0 encodingUTF-8 standaloneno?beans xmlnshttp://www.spri

spring3 注入问题

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
??? xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
??? xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
??? xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
??? xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd??
??? 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/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd??
??? http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

??? <context:property-placeholder location="classpath*:META-INF/spring/*.properties" />

??? <context:spring-configured />

<!-- 如果不增加此配置,注入@Inject 将不起作用 报:expected at least 1 bean which qualifies as autowire candidate for this dependency 异常-->
??? <context:annotation-config/>

??? <!-- 将Controller的注解排除掉 -->
??? <context:component-scan base-package="com.lsoba.gou">
??? ??? <context:exclude-filter expression="org.springframework.stereotype.Controller"
??? ??? ??? type="annotation" />
??? </context:component-scan>

??? <context:property-override location="classpath:override.properties" />

??? <bean id="dataSource" value="com.mysql.jdbc.Driver" />
??? ??? <property name="url" value="jdbc:mysql://localhost:3306/lsoba" />
??? ??? <property name="username" value="root" />
??? ??? <property name="password" value="lijian" />
??? </bean>


??? <bean ref="entityManagerFactory" />
??? </bean>
??? <tx:annotation-driven proxy-target-/>
??? <bean
??? ??? ref="dataSource" />
??? </bean>

</beans>

热点排行