btp-environment-variable-access
btp-environment-variable-access copied to clipboard
Feat: Make `ClassLoader` optional argument for service loading
Context
The method ServiceBindingAccessor.getInstancesViaServiceLoader()
uses service loader pattern.
By default the class' class loader will be used: ServiceBindingAccessor.class.getClassLoader()
. There is now way to customize.
Request
Allow optional parameter ClassLoader
for serivce loader API usage.
Suggestions
Overload method ServiceBindingAccessor.getInstancesViaServiceLoader(ClassLoader)
.
Questions
- Why?
- For service loader pattern we've noticed issues with different class loaders and issues with casting classes between them. This method would be useful in case of troubleshooting. Otherwise, I find these problems are almost impossible to debug.
- What are the use cases?
- Multiple or different versions per classloader, e.g. via buildpack and via application binary.