> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/ix.-how-to-guides/74.-properties-and-configuration/74.1.-automatically-expand-properties-at-build-time/74.1.2.-automatic-property-expansion-using-gradle.md).

# 74.1.2. 使用Gradle自动暴露属性

你可以通过配置Java插件的`processResources`任务自动暴露来自Gradle项目的属性：

```
processResources {
    expand(project.properties)
}
```

然后你可以通过占位符引用Gradle项目的属性：

```
app.name=${name}
app.description=${description}
```

**注** Gradle的`expand`方法使用Groovy的`SimpleTemplateEngine`转换`${..}`占位符，`${..}`这种格式跟Spring自身的属性占位符机制冲突，想要自动暴露Spring属性占位符，你需要将其进行编码，比如`\${..}`。
