为了账号安全,请及时绑定邮箱和手机立即绑定

Spring MVC:找不到类型为 [org.hibernate.SessionFactory]

Spring MVC:找不到类型为 [org.hibernate.SessionFactory]

繁花不似锦 2021-10-06 10:24:00
我得到一个很长的嵌套异常,最后一个是:Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.hibernate.SessionFactory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}at ...这是我的 DAOimport org.hibernate.SessionFactory;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Repository;import org.springframework.transaction.annotation.Transactional;import ar.edu.itba.paw.FileUploadDao;import ar.edu.itba.paw.models.UploadFile;@Repositorypublic class FileUploadDAOImpl implements FileUploadDao {    @Autowired    private SessionFactory sessionFactory;    public FileUploadDAOImpl() {    }    public FileUploadDAOImpl(SessionFactory sessionFactory) {        this.sessionFactory = sessionFactory;    }    @Transactional    public void save(UploadFile uploadFile) {        sessionFactory.getCurrentSession().save(uploadFile);    }}这是我在 DAO 所在的持久性文件夹中的 pom.xml。<?xml version="1.0"?><project    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">    <modelVersion>4.0.0</modelVersion>    <parent>        <groupId>ar.edu.itba.paw</groupId>        <artifactId>paw2018b</artifactId>        <version>1.0-SNAPSHOT</version>    </parent>    <groupId>ar.edu.itba.paw</groupId>    <artifactId>interfaces</artifactId>    <version>1.0-SNAPSHOT</version>    <name>interfaces</name>    <url>http://maven.apache.org</url>    <properties>
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 309 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信