> 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/iv.-spring-boot-features/24.-externalized-configuration/24.7.-type-safe-configuration-properties/24.7.1.-third-party-configuration.md).

# 24.7.1. 第三方配置

`@ConfigurationProperties`不仅可以注解在类上，也可以注解在public `@Bean`方法上，当你需要为不受控的第三方组件绑定属性时，该方法将非常有用。

为了从`Environment`属性中配置一个bean，你需要使用`@ConfigurationProperties`注解该bean：

```java
@ConfigurationProperties(prefix = "another")
@Bean
public AnotherComponent anotherComponent() {
    ...
}
```

和之前的`AcmeProperties`的示例方式相同，所有以`another`为前缀的属性定义都会被映射到`AnotherComponent`上。
