nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate'

异常信息关键字:
nested exception is java.lang.IllegalArgumentException: ‘sessionFactory’ or ‘hibernateTemplate’ is required

1、检查sessionFactory是否正确配置

2、applicationContext.xml
添加 default-autowire =”byName”

< beans xmlns= "http://www.springframework.org/schema/beans"
    xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context= "http://www.springframework.org/schema/context"
    xmlns:tx= "http://www.springframework.org/schema/tx"
    xmlns:jaxws= "http://cxf.apache.org/jaxws"
    xmlns:mvc= "http://www.springframework.org/schema/mvc "
    xmlns:aop= "http://www.springframework.org/schema/aop"
    xsi:schemaLocation= "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
        http://cxf.apache.org/jaxws
        http://cxf.apache.org/schemas/jaxws.xsd"
        default-autowire ="byName"   >

猜你喜欢

转载自blog.csdn.net/yang_lover/article/details/79319230