swagger-api / swagger-parser

Swagger Spec to Java POJOs
http://swagger.io
Apache License 2.0
781 stars 527 forks source link

Add fallback to Thread Context Class Loader for resource loading #1969

Closed mimkorn closed 1 year ago

mimkorn commented 1 year ago

This commit adds a fallback to Thread.currentThread().getContextClassLoader().getResourceAsStream(file) in the ClasspathHelper class.

Previously, if the ClasspathHelper.class.getResourceAsStream(file) and ClassLoader.getSystemResourceAsStream(file) methods returned null, no further attempts were made to load the resource, which caused issues in Quarkus applications in dev mode.

This commit adds an additional fallback to Thread.currentThread().getContextClassLoader().getResourceAsStream(file) to improve compatibility with the Quarkus class loading model.

Related Issue: #1968