[ https://issues.apache.org/jira/browse/CXF-8103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16921755#comment-16921755 ]
Andriy Redko edited comment on CXF-8103 at 9/3/19 10:36 PM: ------------------------------------------------------------ Hi [~kkurucz] , So we've clear picture now what is the issue. Indeed it was caused by changes in Swagger, which basically **always** scans the classpath if *resourcePackages* or *resourceClasses* are not specified (your case). So there are 2 ways to overcome this behavior: # Add the any package to *OpenApiFeature*, for example {code:java} feature.setResourceClasses(Collections.singleton("*")); {code} In this case, the classes will be properly picked up from *Application* instances. 2. Explicitly set the classes to scan but in this case you cannot used generic bean and have to add the feature instance manually, for example: {code:java} @Bean public Server sampleServer(Bus bus) { final JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); endpoint.setBus(bus); endpoint.setAddress("/api"); endpoint.setServiceBean(new Sample()); final OpenApiFeature feature = new OpenApiFeature(); feature.setScan(false); feature.setUseContextBasedConfig(true); feature.setSwaggerUiConfig(new SwaggerUiConfig().url("openapi.json")); feature.setResourceClasses(Collections.singleton(Sample.class.getName())); endpoint.getFeatures().add(feature); return endpoint.create(); } @Bean public Server sample2Server(Bus bus) { final JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); endpoint.setBus(bus); endpoint.setAddress("/api2"); endpoint.setServiceBean(new Sample2()); final OpenApiFeature feature = new OpenApiFeature(); feature.setScan(false); feature.setUseContextBasedConfig(true); feature.setSwaggerUiConfig(new SwaggerUiConfig().url("openapi.json")); feature.setResourceClasses(Collections.singleton(Sample2.class.getName())); endpoint.getFeatures().add(feature); return endpoint.create(); } {code} In this case you don't need *FeatureConfiguration* class anymore. This is what we have at the moment. Best Regards, Andriy Redko was (Author: reta): Hi [~kkurucz] , So we've clear picture now what is the issue. Indeed it was caused by changes in Swagger, which basically **always** scans the classpath if *resourcePackages* or *resourceClasses* are not specified (your case). So there are 2 ways to overcome this behavior: # Add the any package to *OpenApiFeature*, for example {code:java} feature.setResourceClasses(Collections.singleton("*")); {code} In this case, the classes will be properly picked up from *Application* instances. # Explicitly set the classes to scan but in this case you cannot used generic bean and have to add the feature instance manually, for example: {code:java} @Bean public Server sampleServer(Bus bus) { final JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); endpoint.setBus(bus); endpoint.setAddress("/api"); endpoint.setServiceBean(new Sample()); final OpenApiFeature feature = new OpenApiFeature(); feature.setScan(false); feature.setUseContextBasedConfig(true); feature.setSwaggerUiConfig(new SwaggerUiConfig().url("openapi.json")); feature.setResourceClasses(Collections.singleton(Sample.class.getName())); endpoint.getFeatures().add(feature); return endpoint.create(); } @Bean public Server sample2Server(Bus bus) { final JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); endpoint.setBus(bus); endpoint.setAddress("/api2"); endpoint.setServiceBean(new Sample2()); final OpenApiFeature feature = new OpenApiFeature(); feature.setScan(false); feature.setUseContextBasedConfig(true); feature.setSwaggerUiConfig(new SwaggerUiConfig().url("openapi.json")); feature.setResourceClasses(Collections.singleton(Sample2.class.getName())); endpoint.getFeatures().add(feature); return endpoint.create(); } {code} In this case you don't need *FeatureConfiguration* class anymore. This is what we have at the moment. Best Regards, Andriy Redko > OpenApiFeature - cannot use useContextBasedConfig > ------------------------------------------------- > > Key: CXF-8103 > URL: https://issues.apache.org/jira/browse/CXF-8103 > Project: CXF > Issue Type: Bug > Components: JAX-RS, Services > Affects Versions: 3.3.3 > Reporter: Krisztian Kurucz > Assignee: Andriy Redko > Priority: Major > Attachments: description_openapi_v3_spring_boot.7z > > > In case of Using Multiple Server Endpoints all openapi.json will contain all > resource descriptions -- This message was sent by Atlassian Jira (v8.3.2#803003)