• 提示:Mapped Statements collection does not contain value for org.example.mapper.ZhuanyeMapper.selectZhuanye


    错误提示

    Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.example.mapper.ZhuanyeMapper.selectZhuanye
    	at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:888)
    	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:721)
    	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:714)
    	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
    

    1、你的mapper配置文件错了

    2、mybatis-config中的mapper配置文件没有映射到

    解决:
    下面是我刚学的时候出现的错误
    错误文件mybatis-config.xml

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE configuration
            PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
            "http://mybatis.org/dtd/mybatis-3-config.dtd">
    <configuration>
        <environments default="development">
            <environment id="development">
                <transactionManager type="JDBC"/>
                <dataSource type="POOLED">
                    <property name="driver" value="com.mysql.cj.jdbc.Driver"/>
                    <property name="url" value="jdbc:mysql://localhost:3306/wczy?serverTimezone=UTC"/>
                    <property name="username" value="root"/>
                    <property name="password" value="123456"/>
                </dataSource>
            </environment>
        </environments>
    </configuration>
    
    

    修改后

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE configuration
            PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
            "http://mybatis.org/dtd/mybatis-3-config.dtd">
    <configuration>
        <environments default="development">
            <environment id="development">
                <transactionManager type="JDBC"/>
                <dataSource type="POOLED">
                    <property name="driver" value="com.mysql.cj.jdbc.Driver"/>
                    <property name="url" value="jdbc:mysql://localhost:3306/wczy?serverTimezone=UTC"/>
                    <property name="username" value="root"/>
                    <property name="password" value="123456"/>
                </dataSource>
            </environment>
        </environments>
        <mappers>
            <!--mappel.xml文件的映射-->
            <mapper resource="org/example/mapper/Mapper.xml"/>
        </mappers>
    </configuration>
    
    
  • 相关阅读:
    python爬虫练习5——新闻联播
    python爬虫练习4——腾讯视频评论提取
    python爬虫练习3——豆瓣电影
    python爬虫练习2——豆瓣读书
    python爬虫练习1——百度阅读榜
    微信小程序音频视频下载(fiddler抓包)
    4. Median of Two Sorted Arrays
    42.trapping-rain-water
    3.lengthOfLongestSubstring
    1.two sum
  • 原文地址:https://www.cnblogs.com/liuzhijun666/p/14044745.html
Copyright © 2020-2023  润新知