The Spring Beans are Java Objects that are initialized by the Spring IoC container.
The recommended approach is to use constructor arguments for mandatory dependencies and setters for optional ones. Constructor injection allows injecting values to immutable fields and makes testing easier. [1]