注入自动连接的依赖项失败。

时间:2016-05-09 05:28:19

标签: java xml spring-mvc autowired

我收到以下异常org.springframework.beans.factory.BeanCreationException:创建名称为' dispatcher'的注册自动连接依赖项失败;嵌套异常是org.springframework.beans.factory.BeanCreationException

<mvc:annotation-driven />       
    <context:component-scan base-package="com.demo.*"/>
    <context:annotation-config /> 


   <mvc:resources location="/resources/**" mapping="/resources/**"/>

    <bean id="viewResolver"
       class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass"
            value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="suffix" value=".jsp" />

    </bean>

    <bean id="dataSource"
         class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="oracle.jdbc.OracleDriver" />
        <property name="url" value="jdbc:oracle:thin:@localhost:1521/Spring" />
        <property name="username" value="username" />
        <property name="password" value="password" />
    </bean>

    <bean id="sessionFactory"
            class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
            <property name="dataSource" ref="dataSource" />
             <property name="packagesToScan">
                 <list>
                    <value>com.demo.bean</value>
                 </list>
            </property>
            <property name="hibernateProperties">
                <props>


                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> 
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.connection.autocommit">false</prop>
                </props>
            </property>
    </bean>



<tx:annotation-driven transaction-manager="transactionManager"/>
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

0 个答案:

没有答案