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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2022-01-08
  • 2021-09-13
  • 2021-07-27
  • 2022-12-23
猜你喜欢
  • 2021-07-26
  • 2022-12-23
  • 2021-12-16
  • 2021-06-18
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
相关资源
相似解决方案