Spring 注释注入问题
刚学Spring 遇到个问题 求解 谢谢
控制台错误:
xmlns:aop="http://www.springframework.org/schema/aop" 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/context
http://www.springframework.org/schema/context/spring-context-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" default-autowire="byName">
<context:component-scan base-package="com.test.iims" />
<!--Author:Sky CreateDate:2013-04-09 读取属性文件 *.properties -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:mail.properties</value>
</list>
</property>
</bean>
<!--Author:Sky CreateDate:2013-04-09 定义一个数据源 dataSource -->
<bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
<!--Author:Sky CreateDate:2013-04-11 定义一个邮件服务器信息 mail -->
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host">
<value>${mail.hosts}</value>
</property>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">${mail.auth}</prop>
<prop key="mail.smtp.timeout">${mail.timeout}</prop>
<prop key="mail.smtp.from">${mail.user}</prop>
</props>
</property>
<property name="username">
<value>${mail.user}</value>
</property>
<property name="password">
<value>${mail.password}</value>
</property>
</bean>
<!--Author:Sky CreateDate:2013-04-09 创建一个sessionFactory 与 hibernate3整合使用 , 注意:hibernate.dialect 的值-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>com.test.iims.entity</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<!--
防止Exception in thread "main" org.hibernate.HibernateException: No
CurrentSessionContext configured!
-->
<prop key="current_session_context_class">thread</prop>
<!-- 是否展示HQL语句 -->
<prop key="hibernate.show_sql">true</prop>
<!-- 规范HQL在控制台输出的格式 -->
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
</bean>
<!--Author:Sky CreateDate:2013-04-09 创建一个由sessionFactory 映射的 hibernateTemplate -->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!--Author:Sky CreateDate:2013-04-09 AOP管理配置,配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- Author:Sky CreateDate:2013-04-09 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="modify*" propagation="REQUIRED" />
<tx:method name="*Order*" propagation="REQUIRED" />
<tx:method name="send*" propagation="REQUIRED" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>
<!--Author:Sky CreateDate:2013-04-09 那些类的哪些方法参与事务 -->
<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution(public * com.test.iims.service..*.*(..))" />
<aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice" />
</aop:config>
</beans>