Last active
October 1, 2019 16:30
-
-
Save bdkosher/df76885ddcf4b47df978747bb20fe12e to your computer and use it in GitHub Desktop.
Constructor Injection that feels like Field Injection. Lombok generates a constructor for all final fields.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.RequiredArgsConstructor; | |
import org.springframework.stereotype.Component; | |
@Component | |
@RequiredArgsConstructor | |
public class SomeBean { | |
private final SomeDependency someDependency; | |
private final OtherDependency otherDependency; | |
// Lombok auto-generates a two-arg constructor that Spring uses to inject dependencies | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment