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.

Lacking injection point information when using the deprecated DependenyChain replacement.

See original GitHub issue

The provided example to replace the deprecated dependency chain method doesn’t provide enough context about which field or parameter is being injected. I tried to replace dependency chain method, but the most accurate I got was knowing which method/constructor/class is being injected.

Knowing which field/parameter is being injected allowed Providers to return values based on the annotated elements, without having to bind each possible combination.

The dependency chain solution can be found in the following PR changes: https://github.com/SpongePowered/SpongeCommon/pull/1435/files/1bd19db6f0b2363b8bc72960df0b0947e04cc1e0 A custom InjectionPoint is constructed from the information in the dependency chain, this object only exposes the annotations/type/target type of the field/parameter. There is also a small example available in the PR.

Then I was looking for a different solution for the dependency chain and ended up stuck in the following changes: https://github.com/LanternPowered/LanternServer/commit/f67d3e86af549b7e64c43f5f0de85d6fe5aaf211

Not sure what the best solution could be to resolve the issue, undeprecating the getDependencyChain method is an option. Or similar to the InjectionPoint injection, could it also be done for the Dependency by guice itself, making it unnecessary to scan the chain. Maybe you guys can find a better solution for this issue. Maybe there is even a different solution that I haven’t been able to find.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:8
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
kashikecommented, Jun 24, 2018

another poke, @lukesandberg - input?

1reaction
kashikecommented, Apr 11, 2018

@lukesandberg - input?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring's Annotation Type Required deprecation - Stack Overflow
It has Required annotation in a non Spring managed Bean. If I replace that with constructor injection with @Autowired, I get warnings saying...
Read more >
Field injection is not recommended – Spring IOC - Marc Nuri
This post shows the different types of injections available in Spring and what are the recommended patterns to use each of them.
Read more >
Java @Deprecated annotation examples - CodeJava.net
Since Java 1.5, programmers can use the @Deprecated annotation type to mark a program's element (class, method, field and constructor) ...
Read more >
API Best Practices for Feature Deprecation | Moesif Blog
Deprecating endpoints and API features requires careful planning to ... A few parts of the software industry try to use this practice to ......
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