@Data
@AllArgsConstructor
@NoArgsConstructor
public class GoodDto {
private Integer id;
private String name;
private String price;
private Description description;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GoodVo {
private Integer id;
private String name;
private Description description;
}
测试类如下:
public class BeanUtilsTest {
public static void main(String[] args) {
Description description = new Description("详情");
GoodDto goodDto = new GoodDto();
GoodVo goodVo = new GoodVo(999,"2222",description);
BeanUtils.copyProperties(goodVo,goodDto);
System.out.println(goodVo);
System.out.println("------------------------");
System.out.println(goodDto);
System.out.println(">>>>>>>>>>&g