<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.2</version>
</dependency>
User user=new User();
Map map=new HashMap();
map.put("username","张三");
map.put("id",1);
map.put("password",1345);
BeanUtils.populate(user,map);
System.out.println(user);