question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extend binding API to create aliases

See original GitHub issue

we want to have something like

bind(IFoo1.class).to(Foo.class);
bind(IFoo2.class).to(Foo.class);
@Singleton class Foo {} 

But the issue is that doing so would create to 2 Foo instances, kept in internal providers for the keys Foo1 and Foo2.

It would be nice to have something like an alias

bind(IFoo2.class).asAliasOf(IFoo1.class);

so that the keys Foo1 and Foo2 would point to the same internal provider.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
aartikovcommented, Sep 20, 2017

In my opinion the expected behavior for this code is to create a single instance of Foo without any aliases. Otherwise what does @Singleton mean here?

0reactions
dimsuzcommented, Aug 7, 2019

Yes, seems like a viable option!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data-binding - Coherent Prysm Exporter Documentation
Data-binding aliases exist only in the Prysm Animate Plugin and are used to generate data-binding expressions. They do not have a representation in...
Read more >
Creating multiple aliases for the same QueryDSL path in ...
I am trying to extend the basic equality testing built into the default repository implementation, so that I can perform other query operations ......
Read more >
Aliases API | Elasticsearch Guide [8.5] | Elastic
Aliases API edit. Performs one or more alias actions in a single atomic operation.
Read more >
Extending the Kubernetes API with Custom Resources
To create custom objects, you must first create a custom resource definition (CRD). Only cluster admins can create CRDs. Procedure. To create a...
Read more >
Routing traffic to an Amazon API Gateway API by using your ...
An API Gateway API that has a custom domain name, such as api.example.com that matches the name of the Route 53 record that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found