Hi all, fundamentally the following code I've got for handling Spring Boot constructor injection works:
@RequiredArgsConstructor
@Service
public class FooService {
private final MyBean myBean;
// ...
}
The above is an alternative to the documented way of performing Constructor Injection by outright defining the constructor and its arguments:
@Service
public class FooService {
private final MyBean myBean;
public FooService(MyBean myBean) {
this.myBean = myBean;
}
// ...
}
From a compilation perspective, these evaluate to the exact same code (as far as I know).
Is there any reason that anybody can think of as to why I shouldn't use Lombok's RequiredArgsConstructor here?