Constructor Injection —enforcing immutability This is the most straightforward and recommended way of dependency injection. A dependent class has a constructor, where all dependencies are set, they will be provided by Spring container according to XML, Java or annotation based configurations. @Service public class DependentService { private final Service1 service1; private final Service2 service..