Package io.dropwizard.core
Class Configuration
java.lang.Object
io.dropwizard.core.Configuration
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 an ExampleConfiguration instance
to your application whose getName() method will return "Random Person" and whose
getAge() method will return 43.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the admin interface-specific section of the configuration file.Optional<io.dropwizard.health.HealthFactory>Returns the health interface-specific section of the configuration file.io.dropwizard.logging.common.LoggingFactoryReturns the logging-specific section of the configuration file.io.dropwizard.metrics.common.MetricsFactoryReturns the server-specific section of the configuration file.voidsetAdminFactory(AdminFactory admin) Sets the admin interface-specific section of the configuration file.voidsetHealthFactory(io.dropwizard.health.HealthFactory health) Sets the health interface-specific section of the configuration file.voidsetLoggingFactory(io.dropwizard.logging.common.LoggingFactory factory) Sets the logging-specific section of the configuration file.voidsetMetricsFactory(io.dropwizard.metrics.common.MetricsFactory metrics) voidsetServerFactory(ServerFactory factory) Sets the HTTP-specific section of the configuration file.toString()
-
Constructor Details
-
Configuration
public Configuration()
-
-
Method Details
-
getServerFactory
Returns the server-specific section of the configuration file.- Returns:
- server-specific configuration parameters
-
setServerFactory
Sets the HTTP-specific section of the configuration file. -
getLoggingFactory
public io.dropwizard.logging.common.LoggingFactory getLoggingFactory()Returns the logging-specific section of the configuration file.- Returns:
- logging-specific configuration parameters
-
setLoggingFactory
public void setLoggingFactory(io.dropwizard.logging.common.LoggingFactory factory) Sets the logging-specific section of the configuration file. -
getMetricsFactory
public io.dropwizard.metrics.common.MetricsFactory getMetricsFactory() -
setMetricsFactory
public void setMetricsFactory(io.dropwizard.metrics.common.MetricsFactory metrics) -
getAdminFactory
Returns the admin interface-specific section of the configuration file.- Returns:
- admin interface-specific configuration parameters
- Since:
- 2.0
-
setAdminFactory
Sets the admin interface-specific section of the configuration file.- Since:
- 2.0
-
getHealthFactory
Returns the health interface-specific section of the configuration file.- Returns:
- health interface-specific configuration parameters
- Since:
- 2.1
-
setHealthFactory
public void setHealthFactory(io.dropwizard.health.HealthFactory health) Sets the health interface-specific section of the configuration file.- Since:
- 2.1
-
toString
-