为了账号安全,请及时绑定邮箱和手机立即绑定

无法运行起来

其中数据库配置

<table tableName="dw_admin" domainObjectName="AdminDO" enableCountByExample="false"
 enableSelectByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
 selectByExampleQueryId="false"></table>

    java代码

@SpringBootApplication(scanBasePackages = {"com.miaoshaproject"})
@RestController
@MapperScan("com.miaoshaproject.dao")
public class App
{
    @Autowired
    private AdminDOMapper adminDOMapper;


    @RequestMapping("/")
    public String home(){
        AdminDO adminDO = adminDOMapper.selectByPrimaryKey(1);

        if (adminDO == null){
            return "Hello world !";
        }
        else{
            return adminDO.getUserName();
        }
    }

    public static void main( String[] args ) {
        System.out.println( "Hello World!" );
        SpringApplication.run(App.class, args);
    }
}

启动报错

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'app': Unsatisfied dependency expressed through field 'adminDOMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminDOMapper' defined in file [/Users/pro/Desktop/java_project/target/classes/com/miaoshaproject/dao/AdminDOMapper.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 [/Users/pro/Desktop/java_project/target/classes/mapping/AdminDOMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.miaoshaproject.dao.AdminDOMapper.BaseResultMap


正在回答

2 回答

我也有这个问题 一模一样

0 回复 有任何疑惑可以回复我~

删掉生成的文件,重新执行

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

无法运行起来

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信