SSM异常

℡╲_俬逩灬. 提交于 2019-11-30 05:45:21

1、文档根元素 "mapper" 必须匹配 DOCTYPE 根 "null":sql映射文件没有加说明

在sql映射文件上面添加说明:

    <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"         
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

 

2、元素类型为 "configuration" 的内容必须匹配 “(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,reflectorFactory?,plugins?,environments?,databaseIdProvider?,mappers?)"。

问题:只能有一个<mappers>标签

解决:去除多余<mappers>,将<mapper>写在一个<mappers>里

 

3、No qualifying bean of type [Bean.Pig] is defined: expected single matching bean but found 2: pig1,pig2

问题:spring的xml文件里Bean有多个<Bean绑定Bean类,getBean(Class)方法只能获取xml文件里只有一个<Bean>的对象

 

4、org.springframework.beans.NullValueInNestedPathException: Invalid property 'pig' of bean class [Bean.Person]: Value of nested property 'pig' is null

问题:spring里的Bean文件使用了级联属性,但没有先初始化Bean属性对象。

解决:先初始化Bean属性对象

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!