idea使用mapper注解会baohong

问题

Autowired mapper组件结果却爆红了
@mapper注解方式是通过在 xml中的namespace命名空间配置的
idea使用mapper注解会baohong
idea使用mapper注解会baohong

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的路径
idea使用mapper注解会baohong

idea使用mapper注解会baohong

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

idea使用mapper注解会baohong

上一篇:迁移 Windows 上 Oracle 11.2.0.3.0 到 Linux 上 Oracle 11.2.0.3.0


下一篇:在uni-app中使用阿里巴巴图标库字体图标