> For the complete documentation index, see [llms.txt](https://ankang.gitbook.io/commons/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ankang.gitbook.io/commons/commons-beans/gong-neng/jian-dan-ying-she.md).

# 简单映射

跟简单的属性拷贝工具一样，对于名称和类型完全相同的属性，使用者可以不做任何配置完成源对象到目标对象的映射。

```java
class Foo {
    String name;
    Date date;
    Bar bar;
}
class FooDto {
    String name;
    Date date;
    Bar bar;
}

FooDto fooDto = BeanUtils.copyProperties(foo, FooDto.class);
footDto.getDate().setTime(new Random().nextLong());

System.out.println(fooDto.getDate().equals(foo.getDate())); // true
System.out.println(fooDto.getBar() == foo.getBar()); // true
```

{% hint style="warning" %}
如果映射的属性是对象，会直接拷贝该对象的引用，因此对于目标对象的操作会反映到源对象中。
{% endhint %}
