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

  
    id, `name`, `password`
  
  
    id, `name`, `password`
  

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

你可能感兴趣的:(Mybatis)