`
<!--虚拟数据依赖-->
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
</dependency>
// 实体类
@Data
public class UserInfo implements Serializable {
/**
* 真实姓名
*/
private String realName;
/**
* 手机
*/
private String cellPhone;
/**
* 大学
*/
private String universityName;
/**
* 城市
*/
private String city;
/**
* 地址
*/
private String street;
public class DemoController {
public static void main(String[] args) {
//new 个Faker对象 Locale.CHINA代表中国
Faker fakerWithCN = new Faker(Locale.CHINA);
for (int i = 0; i < 10; i++) {
UserInfo userInfo = new UserInfo();
userInfo.setRealName(fakerWithCN.name().fullName());
userInfo.setCellPhone(fakerWithCN.phoneNumber().cellPhone());
userInfo.setCity(fakerWithCN.address().city());
userInfo.setStreet(fakerWithCN.address().streetAddress());
userInfo.setUniversityName(fakerWithCN.university().name());
System.out.println("userInfo = " + userInfo);
}
}
}
`