You could create a base configuration as you mentioned and then also override 
Application<MyOrganizationConfiguration>, override initialize() in your base 
and provide a new hook for applications that extend it, e.g.

AbstractApplication extends Application< MyOrganizationConfiguration >{
 
  // applications extending the base would run their bootstrap here
  public abstract void doInitialize(bootstrap);

  public void initialize(bootstrap){
   // handle common bundles

   doInitialize(bootstrap);
  }
}

Then, you use the two base application and config classes in your applications 
with most of the common plumbing included. You’d just have to package that as a 
library and depend on that to bring in all the common code and dependencies you 
usually use.

Graham

> On 7 Sep 2018, at 09:22, Henrik Stråth <[email protected]> wrote:
> 
> In my organization, all services has the same ObjectMapper config, Metrics 
> reporting setup, Authentication library, request tracing setup, etc. I 
> imagine that this is the case for most organizations. I'm looking for best 
> practices on how to minimize the amount of boilerplate in the services, by 
> providing a organization-preconfigured Dropwizard.
> 
> My initial idea is to create a MyOrganizationConfiguration (with default 
> values) that would extend Configuration, and also provide a static method 
> that would add various Bundles (e.g. 
> ConfiguredBundle<MyOrganizationConfiguration>) to the application.
> 
> Anyone want to share how this is done at their organization?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "dropwizard-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to