首页 > 移动平台 > 详细

idea使用mapper注解会baohong

时间:2020-03-18 16:00:44      阅读:109      评论:0      收藏:0      [点我收藏+]

问题

Autowired mapper组件结果却爆红了
@mapper注解方式是通过在 xml中的namespace命名空间配置的
技术分享图片
技术分享图片

package com.example.demo123.mapper;

import com.example.demo123.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
public interface UserMapper {
    List<User> queryUserList();
    User queryById(int id);

    int deleteUser(int id);
    int addUser(User user);
}

但并不影响正常运行
可通过调整idea的警报级别解决
也可以使用另一种注解 :Repository,但是需要在配置文件中指明扫描xml的路径
技术分享图片

技术分享图片

mybatis:
  mapper-locations: classpath:mybatis/*Mapper.xml
  type-aliases-package: com.example.demo123.pojo

idea使用mapper注解会baohong

原文:https://www.cnblogs.com/whiplasher/p/12517399.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!