@Retention(value=RUNTIME) @Target(value=TYPE) @Documented @Import(value=ApolloConfigRegistrar.class) public @interface EnableApolloConfig
Configuration example with multiple namespaces:
@Configuration
@EnableApolloConfig({"someNamespace","anotherNamespace"})
public class AppConfig {
}
Configuration example with placeholder:
// The namespace could also be specified as a placeholder, e.g. ${redis.namespace:xxx},
// which will use the value of the key "redis.namespace" or "xxx" if this key is not configured.
// Please note that this placeholder could not be configured in Apollo as Apollo is not activated during this phase.
@Configuration
@EnableApolloConfig({"${redis.namespace:xxx}"})
public class AppConfig {
}
| Modifier and Type | Optional Element and Description |
|---|---|
MultipleConfig[] |
multipleConfigs
Additional appId and namespace configurations.
|
int |
order
The order of the apollo config, default is
Ordered.LOWEST_PRECEDENCE, which is Integer.MAX_VALUE. |
String[] |
value
Apollo namespaces to inject configuration into Spring Property Sources.
|
public abstract String[] value
public abstract int order
Ordered.LOWEST_PRECEDENCE, which is Integer.MAX_VALUE.
If there are properties with the same name in different apollo configs, the apollo config with smaller order wins.public abstract MultipleConfig[] multipleConfigs
Copyright © 2025. All rights reserved.