Skip to content

Feat: Make ClassLoader optional argument for service loading #73

Description

@newtork

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions