onConstructor handling
See original GitHub issueLombok provides a nice trick to generate constructors with additional annotations added to them. This helps a lot with writing code that uses dependency injection, e.g. with Spring Framework.
A simple testcase looks as following:
@Component @RequiredArgsConstructor(onConstructor = @__(@Autowired)) public class SomeService {
private final SomeRepository someRepository;
private final AnotherRepository anotherRepository;
public void someLogic() {
}
}
The problem is that that Lombok Intellij plugin doesn’t seem to understand Lombok’s specific @__ syntax.
Issue Analytics
- State:
- Created 7 years ago
- Comments:11
Top Results From Across the Web
What is the difference between @RequiredArgsConstructor ...
Which one does Spring use to construct your bean? Enter Lombok's @RequiredArgsConstructor(onConstructor = @__(@Inject)) or the more popular @ ...
Read more >@NoArgsConstructor, @RequiredArgsConstructor ...
@RequiredArgsConstructor generates a constructor with 1 parameter for each field that requires special handling. All non-initialized final fields get a ...
Read more >On Constructor Over-injection by Mark Seemann - ploeh blog
Constructor Over-injection is a code smell, not an anti-pattern. Sometimes, people struggle with how to deal with the Constructor ...
Read more >What is the @RequiredArgsConstructor annotation in Lombok?
The final fields annotated with @NonNull are the parameters of the required constructor because they need special handling. For example, final fields need...
Read more >WriteableBitmap crashes on constructor when run from opentap UI ...
WriteableBitmap crashes on constructor when run from opentap UI test launcher ... (to then later convert to an open CV image to do...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is still happening for Intellij 2020.3 and latest lombok plugin version.
@AllArgsConstructor(onConstructor = @__(@Inject) cannot find symbol symbol: class __
It doesn’t work for me either. Using the following annotation:
@AllArgsConstructor(onConstructor = @__(@Inject)
Others annotations seem to be working fine.