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.

InjectAnnotation should allow injecting annotation on factory method

See original GitHub issue

@InjectAnnotation can be used to place an annotation on the constructor of the immutable type using target = Where.CONSTRUCTOR. This is great, but it requires me to use @Value.Style(of = "new") which in turn prevents me from using normalization:

Interning, singleton and validation will not work correctly with ‘new’ constructor configured in style

It would be great if the Annotation would be placed on the static factory method when no public constructor is generated or if there was something like a Where.FACTORY_METHOD that could be used instead of Where.CONSTRUCTOR in such a case.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Adrodoccommented, Dec 13, 2022

Just a small reminder: I still look forward to the release 😉

0reactions
elucashcommented, Dec 13, 2022

2.9.3 released

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency injection and programmatic lookup
The @Inject annotation lets us define an injection point that is injected during bean instantiation. Injection can occur via three different ...
Read more >
Wiring in Spring: @Autowired, @Resource and @Inject
This article will compare and contrast the use of annotations related to dependency injection, namely the @Resource, @Inject, and @Autowired ...
Read more >
Contexts and Dependency Injection - Quarkus
This annotation can be declared on a class, a producer method or field. Since this is not always possible, there is an option...
Read more >
Java: Junit a class with Inject annotation - Stack Overflow
If you use a MockitoJUnitRunner , you can use @Mock to create a mock for the Factory and inject it. @RunWith(MockitoJUnitRunner.class) ...
Read more >
Dependency injection with Dagger 2: @Inject and @Provides
Dependency Injection, or DI in short, is a design pattern that allows ... Each class has an empty constructor with the @Inject annotation....
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