SAP / SAP/btp-environment-variable-access
Feat: Make `ClassLoader` optional argument for service loading
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 24
- Forks
- 13
- Avg merge
- 4h 35m
- Merged PRs (30d)
- 5
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the ServiceBindingAccessor.getInstancesViaServiceLoader() entry point and inspect its current service-loader behavior. Add the optional ClassLoader API described in the request, preserving the default behavior, and verify that callers can use either the default or supplied class loader.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100