Skip to content

Cache java.util.ServiceLoader results #752

@lhazlewood

Description

@lhazlewood

Due to ServiceLoader problems with:

we should migrate away from using the JDK ServiceLoader concept, and at a minimum revert to the previous logic in 0.10.x:

if (this.serializer == null) {
//try to find one based on the runtime environment:
InstanceLocator<Serializer<Map<String,?>>> locator =
Classes.newInstance("io.jsonwebtoken.impl.io.RuntimeClasspathSerializerLocator");
this.serializer = locator.getInstance();
}

Another approach is to create our own API concept similar to ServiceLoader and allow JJWT users to specify their own implementation on the JwtBuilder or JwtParserBuilder. 95% of users would likely never configure a custom one, but it does provide an option to fix things quickly if the default implementation has problems (as opposed to waiting for a new JJWT release).

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