Reintroducing a scan property but set to false by default in 3.2.x
@@ -98,6 +98,7 @@ public class Swagger2Feature extends AbstractSwaggerFeature {
private static final String USE_PATH_CFG_PROPERTY = "use.path.based.config";
private static final String SUPPORT_UI_PROPERTY = "support.swagger.ui";
+ private boolean scan;
private boolean scanAllResources;
private String ignoreRoutes;
@@ -136,7 +137,9 @@ public class Swagger2Feature extends AbstractSwaggerFeature {
ServerProviderFactory factory =
(ServerProviderFactory)server.getEndpoint().get(ServerProviderFactory.class.getName());
- ApplicationInfo appInfo = factory.getApplicationProvider();
+ ApplicationInfo appInfo = null;
+ if (!isScan()) {
+ appInfo = factory.getApplicationProvider();
if (appInfo == null) {
Set<Class<?>> serviceClasses = new HashSet<>();
for (ClassResourceInfo cri : sfb.getClassResourceInfo()) {
@@ -145,6 +148,7 @@ public class Swagger2Feature extends AbstractSwaggerFeature {
appInfo = new ApplicationInfo(new DefaultApplication(serviceClasses), bus);
server.getEndpoint().put(Application.class.getName(), appInfo);
}
+ }
List<Object> swaggerResources = new LinkedList<>();
@@ -346,8 +350,8 @@ public class Swagger2Feature extends AbstractSwaggerFeature {
}
beanConfig.setFilterClass(theFilterClass);
- // Without this call Swagger generator loses the JSON 'info'
- beanConfig.setScan(false);
+ // scan
+ beanConfig.setScan(isScan());
// base path is calculated dynamically
beanConfig.setBasePath(getBasePath());
@@ -454,6 +458,14 @@ public class Swagger2Feature extends AbstractSwaggerFeature {
this.propertiesLocation = propertiesLocation;
}
+ public boolean isScan() {
+ return scan;
+ }
+
+ public void setScan(boolean scan) {
+ this.scan = scan;
+ }
+
private class ServletConfigProvider implements ContextProvider<ServletConfig> {
@Override
