Package io.dropwizard.core
Class Configuration
- java.lang.Object
-
- io.dropwizard.core.Configuration
-
public class Configuration extends Object
An object representation of the YAML configuration file. Extend this with your own configuration properties, and they'll be parsed from the YAML file as well. For example, given a YAML file with this:name: "Random Person" age: 43 # ... etc ...
And a configuration like this:public class ExampleConfiguration extends Configuration { \@NotNull private String name; \@Min(1) \@Max(120) private int age; \@JsonProperty public String getName() { return name; } \@JsonProperty public void setName(String name) { this.name = name; } \@JsonProperty public int getAge() { return age; } \@JsonProperty public void setAge(int age) { this.age = age; } }
Dropwizard will parse the given YAML file and provide anExampleConfiguration
instance to your application whosegetName()
method will return"Random Person"
and whosegetAge()
method will return43
.- See Also:
- YAML Cookbook
-
-
Constructor Summary
Constructors Constructor Description Configuration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AdminFactory
getAdminFactory()
Returns the admin interface-specific section of the configuration file.Optional<HealthFactory>
getHealthFactory()
Returns the health interface-specific section of the configuration file.LoggingFactory
getLoggingFactory()
Returns the logging-specific section of the configuration file.MetricsFactory
getMetricsFactory()
ServerFactory
getServerFactory()
Returns the server-specific section of the configuration file.void
setAdminFactory(AdminFactory admin)
Sets the admin interface-specific section of the configuration file.void
setHealthFactory(HealthFactory health)
Sets the health interface-specific section of the configuration file.void
setLoggingFactory(LoggingFactory factory)
Sets the logging-specific section of the configuration file.void
setMetricsFactory(MetricsFactory metrics)
void
setServerFactory(ServerFactory factory)
Sets the HTTP-specific section of the configuration file.String
toString()
-
-
-
Method Detail
-
getServerFactory
public ServerFactory getServerFactory()
Returns the server-specific section of the configuration file.- Returns:
- server-specific configuration parameters
-
setServerFactory
public void setServerFactory(ServerFactory factory)
Sets the HTTP-specific section of the configuration file.
-
getLoggingFactory
public LoggingFactory getLoggingFactory()
Returns the logging-specific section of the configuration file.- Returns:
- logging-specific configuration parameters
-
setLoggingFactory
public void setLoggingFactory(LoggingFactory factory)
Sets the logging-specific section of the configuration file.
-
getMetricsFactory
public MetricsFactory getMetricsFactory()
-
setMetricsFactory
public void setMetricsFactory(MetricsFactory metrics)
-
getAdminFactory
public AdminFactory getAdminFactory()
Returns the admin interface-specific section of the configuration file.- Returns:
- admin interface-specific configuration parameters
- Since:
- 2.0
-
setAdminFactory
public void setAdminFactory(AdminFactory admin)
Sets the admin interface-specific section of the configuration file.- Since:
- 2.0
-
getHealthFactory
public Optional<HealthFactory> getHealthFactory()
Returns the health interface-specific section of the configuration file.- Returns:
- health interface-specific configuration parameters
- Since:
- 2.1
-
setHealthFactory
public void setHealthFactory(HealthFactory health)
Sets the health interface-specific section of the configuration file.- Since:
- 2.1
-
-