-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Cache java.util.ServiceLoader results #752
Copy link
Copy link
Closed
Milestone
Description
Due to ServiceLoader problems with:
- file I/O at scale as discussed in io.jsonwebtoken.CompressionCodec: Error reading configuration file #648 (comment) as well as
- ClassLoader problems in JEE environments as discussed in Multiple applications using jjwt leading to ServiceConfigurationError io.jsonwebtoken.jackson.io.JacksonSerializer not a subtype #751 (and perhaps this extends to OSGI environments),
we should migrate away from using the JDK ServiceLoader concept, and at a minimum revert to the previous logic in 0.10.x:
jjwt/impl/src/main/java/io/jsonwebtoken/impl/DefaultJwtBuilder.java
Lines 297 to 302 in b292b89
| 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).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels