27 lines
682 B
Java
27 lines
682 B
Java
package com.inmind;
|
|
|
|
import com.inmind.mapper.UserMapper;
|
|
import com.inmind.pojo.User;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
import java.util.List;
|
|
|
|
@SpringBootTest
|
|
class SpringbootMybatisQuickstartApplicationTests {
|
|
|
|
@Autowired//直接从IOC容器中获取UserMapper类型的对象
|
|
private UserMapper userMapper;
|
|
|
|
@Test
|
|
void contextLoads() {
|
|
//使用mybatis框架查询所有用户的数据
|
|
List<User> list = userMapper.list();
|
|
list.stream().forEach(user -> {
|
|
System.out.println(user);
|
|
});
|
|
}
|
|
|
|
}
|