1
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.demo.userCenter.mapper.UserMapper">

</mapper>


@Mapper
public interface UserMapper extends BaseMapper<User> {

}

@RestController
@RequestMapping("/user")
public class UserController {
    private final UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }

    /**
     * 获取user列表
     */
    @PostMapping("/getUserList")
    public List<User> getUserList() {
        return userService.list();
    }
}

public interface UserService extends IService<User> {

}

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {


}

I reported this error when calling getUserList

I have tried various solutions, such as configuration files and annotations, and I have used the correct one, but I still reported an error in the end. I hope someone can help me, thank you

bopomofo
  • 11
  • 1

1 Answers1

0

Do you use @MapperScan annotations ?

if so,then you need to remove it.

This usage causes mybatis-plus to repeat scans.

TomShiDi
  • 1
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 17 '23 at 00:12