当前位置: 代码迷 >> J2EE >> Intellij idea 提醒SessionFactory 没有类型匹配,不能注入
  详细解决方案

Intellij idea 提醒SessionFactory 没有类型匹配,不能注入

热度:329   发布时间:2016-04-17 23:34:20.0
Intellij idea 提示SessionFactory 没有类型匹配,不能注入
错误提示信息: could not autowire. no beans of 'sessionfactory' type found 

下面是我的sessionFactory的配置:
 
<bean id="sessionFactory" autowire="byName" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <!--<property name="mappingLocations">-->
            <!--<list>-->
                <!--<value>classpath:hbm/Channel.hbm.xml</value>-->
            <!--</list>-->
        <!--</property>-->
        <property name="packagesToScan" value="com.jamorn.entity"/>
        <property name="namingStrategy" ref="namingStrategy" />
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
                <prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>
                <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
            </props>
        </property>
    </bean>

------解决思路----------------------
你的hibernate是版本4???
  相关解决方案