XML fragments parsed from previous mappers already contains value for **.UserMapper.Base_Column_List

出现
Error creating bean with name 'userController' defined in file [E:\IntelliJ\workspaces\web_workspaces\best_springboot_mybatis\target\classes\com\test\springbm\controller\UserController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userService' defined in file [E:\IntelliJ\workspaces\web_workspaces\best_springboot_mybatis\target\classes\com\test\springbm\service\UserService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [E:\IntelliJ\workspaces\web_workspaces\best_springboot_mybatis\target\classes\com\test\springbm\mapper\UserMapper.class]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/test/springbm/config/impl/DruidConfig.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 [E:\IntelliJ\workspaces\web_workspaces\best_springboot_mybatis\target\classes\mapper\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IntelliJ\workspaces\web_workspaces\best_springboot_mybatis\target\classes\mapper\UserMapper.xml]'. Cause: java.lang.IllegalArgumentException: XML fragments parsed from previous mappers already contains value for com.test.springbm.mapper.UserMapper.Base_Column_List
错误
说明你的*Mapper.xml里面有个同名对象
如我这个错误就是有个同名的Base_Column_List

  <sql id="Base_Column_List">
    id, `name`, `password`
  </sql>
  <sql id="Base_Column_List">
    id, `name`, `password`
  </sql>

这种的在用Mybatis Generator自动生成代码的时候,如果生成俩次就很容易生成重复代码
需要去掉id同名的对象

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值