初次搭建Spring-boot 項(xiàng)目,通過別人網(wǎng)站上的項(xiàng)目結(jié)構(gòu)搭建。并將原來的配置文件從.property改用YAML配置文件。
項(xiàng)目能正常啟動(dòng),但當(dāng)調(diào)用接口的時(shí)候拋異常:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
mybatis出現(xiàn)這個(gè)問題,通常是由Mapper interface和對應(yīng)的xml文件的定義對應(yīng)不上引起的。
經(jīng)過反復(fù)查找,最后發(fā)現(xiàn)是配置 mybatis 中的一個(gè)屬性時(shí)存在了轉(zhuǎn)譯導(dǎo)致。
檢查mapperLocations 配置是否存在轉(zhuǎn)譯,eg:?mapperLocations: classpath\:mapper/*.xml.
只需要將轉(zhuǎn)譯去除即可。eg:?mapperLocations: classpath:mapper/*.xml.
踩坑之旅,希望能幫助后來之人少走彎路!