> 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/x.-appendices/b.-configuration-metadata/b.2-providing-manual-hints/b.2.1-value-hint.md).

# 附录 B.2.1 值提示

每一个hint的`name`属性参考了property的`name`。在[上面最初的例子](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#configuration-metadata-format)里，我们为`spring.jpa.hibernate.ddl-auto`属性提供了5个值：`none`、`validate`、`update`、`create`和`create-drop`。每个值也可以有一个描述。

如果你的属性不是`Map`类型，你可以为key和value一起提供hint（但不是为map它自己）。特殊的`.keys`和`.values`后缀必须被分别地用于参考keys和values。

让我们假设一个`sample.contexts`，它把神奇的String值映射到一个Integer：

```java
@ConfigurationProperties("sample")
public class SampleProperties {

    private Map<String,Integer> contexts;
    // getters and setters
}
```

例如，神奇的值是`sample1`和`sample2`。为了给key提供额外的内容帮助，你可以将以下内容添加到[模块的手工元数据](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#configuration-metadata-additional-metadata)：

```javascript
{"hints": [
    {
        "name": "sample.contexts.keys",
        "values": [
            {
                "value": "sample1"
            },
            {
                "value": "sample2"
            }
        ]
    }
]}
```

**注** 我们建议你对这两个值使用`Enum`。如果你的IDE支持，这是目前为止实现自动补全的最有效的方式。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://jack80342.gitbook.io/spring-boot/x.-appendices/b.-configuration-metadata/b.2-providing-manual-hints/b.2.1-value-hint.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
