You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2017/10/10 16:11:43 UTC
[cxf] branch master updated: [CXF-7484] Reintroducing a scan
property but set to false by default in 3.2.x
This is an automated email from the ASF dual-hosted git repository.
sergeyb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/master by this push:
new 942ae98 [CXF-7484] Reintroducing a scan property but set to false by default in 3.2.x
942ae98 is described below
commit 942ae98f21489e632533f5fa282ae4c617358c14
Author: Sergey Beryozkin <sb...@gmail.com>
AuthorDate: Tue Oct 10 17:11:26 2017 +0100
[CXF-7484] Reintroducing a scan property but set to false by default in 3.2.x
---
.../apache/cxf/jaxrs/swagger/Swagger2Feature.java | 30 +++++++++++++++-------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
index 3f4b8b2..b33392f 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
+++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
@@ -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,14 +137,17 @@ public class Swagger2Feature extends AbstractSwaggerFeature {
ServerProviderFactory factory =
(ServerProviderFactory)server.getEndpoint().get(ServerProviderFactory.class.getName());
- ApplicationInfo appInfo = factory.getApplicationProvider();
- if (appInfo == null) {
- Set<Class<?>> serviceClasses = new HashSet<>();
- for (ClassResourceInfo cri : sfb.getClassResourceInfo()) {
- serviceClasses.add(cri.getServiceClass());
+ ApplicationInfo appInfo = null;
+ if (!isScan()) {
+ appInfo = factory.getApplicationProvider();
+ if (appInfo == null) {
+ Set<Class<?>> serviceClasses = new HashSet<>();
+ for (ClassResourceInfo cri : sfb.getClassResourceInfo()) {
+ serviceClasses.add(cri.getServiceClass());
+ }
+ appInfo = new ApplicationInfo(new DefaultApplication(serviceClasses), bus);
+ server.getEndpoint().put(Application.class.getName(), appInfo);
}
- appInfo = new ApplicationInfo(new DefaultApplication(serviceClasses), bus);
- server.getEndpoint().put(Application.class.getName(), appInfo);
}
@@ -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
--
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <co...@cxf.apache.org>'].