-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Overriding Default Configurations
Eureka comes with in-built defaults which works for most of the scenarios. In case, you want to override the default configurations, there are 3 types of configurations you might want to look at.
You can extend the following default configuration classes to provide your own configuration value by using any mechanism you would like.
Important: Please do not use the interfaces, they are just for documentation purposes and is likely to change in the future.
- Cloud or Datacenter Instance Configuration both of which extends PropertiesInstanceConfig
- Eureka Client Configuration
- Eureka Server Configuration
Note that the above also serves as the documentation of default configuration values for all of the above configurations available with Eureka.
Sometimes, you may want to add custom metadata specific to your deployment environment for registration and query. For example, you may want to propagate a custom environment id that should be available for your specific deployment env. Eureka offers the ability to add custom metadata as key:value pairs outside of the standard registration data. You can do this in two ways:
String myValue = instanceInfo.getMetadata().get("myKey");
any config of the form
eureka.metadata.mykey=myvalue
will have the k:v pair mykey:myvalue
added to eureka's metadata map.
To dynamically do this, you will need to first provide your own custom implementation of the EurekaInstanceConfig interface. You can then overload the public Map<String, String> getMetadataMap()
method to return a metadata map that contains the desired metadata values. See PropertiesInstanceConfig for an example implementation that provides the configuration based system above.
- Eureka at a glance
- Configuring Eureka
- Building Eureka Client and Server
- Running the Demo Application
- Deploying-Eureka-Servers-in-EC2
- Understanding Eureka Client/Server Communication
- Server Self Preservation Mode
- Eureka REST operations
- Understanding Eureka Peer to Peer communication
- Overriding Default Configurations
- FAQ