Skip to content

Use of static Scanner in ScannerFactory blocks use of multiple Swagger configs in the same JVM #1482

@tfeak

Description

@tfeak

I'm running 2 REST APIs in the same JVM on different ports. They both use Swagger. When calling BeanConfig.scan(true), the ScannerFactory instance is set to the BeanConfig instance making the call. The result is that the second call to this is the one that "wins".

ScannerFactory shouldn't be using a singleton static model. This is a perfect example of the unintended side effect that can occur when an object model leverages static.

As a workaround, I've tried setting up the BeanConfig to scan the packages from both apps. All of the API calls show up in the Swagger UI correctly, but because it's on the wrong port sample calls cannot be made.

EDIT: To clarify, this is part of the swagger-jaxrs packaging

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions