From f118ac6ad45f03ca85d9e29bd3c498a8cd55af91 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Fri, 4 Oct 2024 00:17:25 +0200 Subject: [PATCH] Simplify SwaggerBundleConfiguration setup --- .../verkeersdrukte/app/VerkeersDrukteApp.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/verkeersdrukte/src/main/java/nl/bertriksikken/verkeersdrukte/app/VerkeersDrukteApp.java b/verkeersdrukte/src/main/java/nl/bertriksikken/verkeersdrukte/app/VerkeersDrukteApp.java index 884efd3..1f14528 100644 --- a/verkeersdrukte/src/main/java/nl/bertriksikken/verkeersdrukte/app/VerkeersDrukteApp.java +++ b/verkeersdrukte/src/main/java/nl/bertriksikken/verkeersdrukte/app/VerkeersDrukteApp.java @@ -32,10 +32,7 @@ private VerkeersDrukteApp() { public void initialize(Bootstrap 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 @@ -71,15 +68,15 @@ public static void main(String[] args) throws Exception { } private static final class TrafficSwaggerBundle extends SwaggerBundle { - 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; } }