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

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

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

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

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET 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?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
