日志中指出:“没有找到依赖项类型为[org.hibernate.SessionFactory]的匹配bean:期望至少有1个bean符合此依赖关系的自动装配候选条件”。
您可以在applicationContext.xml中定义它,如本问题所示。在Spring
MVC中使用ApplicationContext。
就像
<bean id="sessionFactory" > <property name="dataSource" ref="dataSource"></property> <property name="mappingResources"> <list> <value>UserAccount.hbm.xml</value> ... </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> </props> </property> </bean>希望能帮助到你。



