Skip to content

Commit

Permalink
Simplify SwaggerBundleConfiguration setup
Browse files Browse the repository at this point in the history
  • Loading branch information
bertrik committed Oct 3, 2024
1 parent 05f9b16 commit f118ac6
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ private VerkeersDrukteApp() {
public void initialize(Bootstrap<VerkeersDrukteAppConfig> bootstrap) {
bootstrap.getObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
bootstrap.addBundle(new AssetsBundle("/assets/verkeersdrukte.png", "/favicon.ico"));

SwaggerBundleConfiguration swaggerBundleConfiguration = new SwaggerBundleConfiguration();
swaggerBundleConfiguration.setResourcePackage(VerkeersDrukteResource.class.getPackage().getName());
bootstrap.addBundle(new TrafficSwaggerBundle(swaggerBundleConfiguration));
bootstrap.addBundle(new TrafficSwaggerBundle(VerkeersDrukteResource.class.getPackage().getName()));
}

@Override
Expand Down Expand Up @@ -71,15 +68,15 @@ public static void main(String[] args) throws Exception {
}

private static final class TrafficSwaggerBundle extends SwaggerBundle<Configuration> {
private final SwaggerBundleConfiguration swaggerBundleConfiguration;
private final SwaggerBundleConfiguration configuration = new SwaggerBundleConfiguration();

TrafficSwaggerBundle(SwaggerBundleConfiguration configuration) {
this.swaggerBundleConfiguration = configuration;
TrafficSwaggerBundle(String resourcePackage) {
this.configuration.setResourcePackage(resourcePackage);
}

@Override
protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(Configuration configuration) {
return swaggerBundleConfiguration;
return this.configuration;
}
}

Expand Down

0 comments on commit f118ac6

Please sign in to comment.