Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NameDescriptionDefault
basePaththe context root path+null
contactthe contact information+null (in CXF 3.1.x "users@cxf.apache.org")
descriptionthe description+null (in CXF 3.1.x "The Application")
filterClassa security filter+null
hostthe host and port+null
ignoreRoutesexcludes specific paths when scanning all resources (see scanAllResources)++null
licensethe license+"Apache 2.0 License"
licenceUrlthe license URL+"http://www.apache.org/licenses/LICENSE-2.0.html"
prettyPrintwhen generating swagger.json, pretty-print the json document+false
resourcePackagea list of comma separated package names where resources must be scanned+a list of service classes configured at the endpoint
runAsFilterruns the feature as a filterfalse
scangenerates the swagger documentation+true
scanAllResourcesscans all resources including non-annotated JAX-RS resources++false
schemesthe protocol schemes+null
termsOfServiceUrlthe terms of service URL+null
titlethe title+null (in CXF 3.1.x "Sample REST Application")
versionthe version+null (in CXF 3.1.x "1.0.0")

Note: those descriptions marked with + correspond to the properties defined in Swagger's BeanConfig, and those marked with ++ correspond to the properties defined in Swagger's ReaderConfig.

...

Code Block
java
java
import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
...

    Swagger2Feature feature = new Swagger2Feature();

    // customize some of the properties
    feature.setBasePath("/api");
    	
   	// add this feature to the endpoint (e.g., to ServerFactoryBean's features) 
   	ServerFactoryBean sfb = new ServerFactoryBean();
   	sfb.getFeatures().add(feature);

...