今天我用springboot和mybatis做了一個小專案,用逆向工程生成了物體類,mapper,和mapper.xml。我用注解寫的普通查詢都正常使用,當我用到mapper里面自動生成的mapper的增刪改查的方法的時候就會報找不到xml的錯誤,于是我在yml檔案中配置了 mapper-locations: classpath:mybatis/mapper/*.xml這個路勁,結果出現了新的錯誤,求大神解答啊

第一行完整報錯是這樣的:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminController': Unsatisfied dependency expressed through field 'iCarDetail'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'carDetailImpl': Unsatisfied dependency expressed through field 'carDetailMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'carDetailMapper' defined in file [C:\Users\留不住的年華\Desktop\dragon-f\target\classes\teach\aistar\mapper\CarDetailMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\留不住的年華\Desktop\dragon-f\target\classes\mybatis\mapper\CarBrandsMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [C:\Users\留不住的年華\Desktop\dragon-f\target\classes\mybatis\mapper\CarBrandsMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for teach.aistar.mapper.CarBrandsMapper.BaseResultMap
uj5u.com熱心網友回復:
Result Maps collection already contains value for teach.aistar.mapper.CarBrandsMapper.BaseResultMap轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/282483.html
標籤:Java相關
上一篇:匿名內部類中使用代碼塊中問題
下一篇:實作頁面選擇不同按鈕,對應不同的所需材料上傳,如選擇新裝對應所需為身份證,房產證,選擇增容對應產權證等,后臺介面如何實作
