@Documented @Retention(value=RUNTIME) @Target(value={METHOD,TYPE}) @Singleton public @interface EachBean
This annotation allows driving the production of Bean
definitions from presence of other bean definitions.
Typically used in conjunction with EachProperty
For example:
@EachProperty("foo.bar")
public class ExampleConfiguration {
}
In the above example a new ExampleConfiguration
bean will be created for each item under the
foo.bar
key in application configuration
One can then drive the configuration of other beans with the same annotation:
@EachBean(ExampleConfiguration)
@Singleton
public class ExampleBean {
ExampleBean(ExampleConfiguration config) {
...
}
}
EachProperty
,
ConfigurationProperties
public abstract Class value