Below you will find pages that utilize the taxonomy term “code”
Posts
Use Consul's KV store for Dropwizard settings
I wanted to see how hard it would be to get Dropwizard config from Consul’s key value store. Turns out it is very easy to do!
Make sure you’re using Dropwizard >= 0.8.0, this has the SubstitutingSourceProvider that we’re going to use.
Create a default Dropwizard project with the following configuration line in its config.yml:
someSetting: ${settings/someSetting}
Don’t forget to add it to the xxxConfiguration:
@JsonProperty @NotEmpty private String someSetting; Now in the xxxApplication class, register a new ConsulKVSubstitutor in the initialize method:
Posts
File upload using Dropwizard 0.8.0-rc2
Dropwizard 0.7.1 used com.sun.jersey:jersey-server:jar:1.18.1, where version 0.8.0 comes with org.glassfish.jersey.core:jersey-server:jar:2.15.
Before, when uploading files, it was enough to add the com.sun.jersey.contribs:jersey-multipart dependency like so:
<dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>1.18.3</version> </dependency> This will not work anymore and throws the somewhat cryptic exception: java.lang.IllegalArgumentException: The MultiPartConfig instance we expected is not present. Have you registered the MultiPartConfigProvider class?
The correct dependency should be
<dependency> <groupId>org.glassfish.jersey.media</groupId> <artifactId>jersey-media-multipart</artifactId> <version>2.15</version> </dependency> Update your imports and you’re good to go.