Annotation Interface ResourcePropertySources


@Target(TYPE) @Retention(RUNTIME) @Inherited @Documented @Import(io.microsphere.spring.config.context.annotation.ResourcePropertySourcesLoader.class) public @interface ResourcePropertySources
A container annotation that holds multiple ResourcePropertySource annotations.

This annotation is used to apply multiple ResourcePropertySource configurations to a single class. It supports the same attributes as the individual annotations and serves as a way to group them logically.

Examples Usage

Basic Usage


 @ResourcePropertySources(value = {
     @ResourcePropertySource(name = "default1", properties = {"key1=value1", "key2=value2"}),
     @ResourcePropertySource(name = "default2", properties = {"key3=value3", "key4=value4"})
 })
 public class MyConfig {
 }
 

Java 8+ @Repeatable Usage


 @ResourcePropertySource(name = "default1", properties = {"key1=value1", "key2=value2"})
 @ResourcePropertySource(name = "default2", properties = {"key3=value3", "key4=value4"})
 public class MyConfig {
 }
 

This example demonstrates how to use the annotation to load properties from both the classpath and an external file. The order of the annotations in the array defines the precedence of the property sources, with the first having the lowest precedence and the last having the highest.

Since:
1.0.0
Author:
Mercy
See Also: