Field injection places a dependency directly in an object's field. In Spring, annotate the field with @Autowired; Spring supplies a matching bean from its context. section 3.2.1
Figure 3.9 Using the @Autowired annotation over the field, we instruct Spring to provide a value for that field from its context. Spring creates the two beans, person and parrot, and injects the parrot object to the field of the bean of type Person.

Spring creates the Person and Parrot beans, then injects the Parrot into Person's annotated field. section 3.2.1
A person and a parrot
Mark Person and Parrot with @Component, annotate Person's Parrot field with @Autowired, and use @ComponentScan to find them. Retrieving Person from the context shows its injected parrot. A CommentService can likewise receive a repository and notification proxy through annotated fields. section 3.2.1 section 4.2.1
Keep the practical trade-off in mind:
- Field injection is straightforward and common in examples, proofs of concept, and tests, but is generally avoided in production; constructor injection is preferred for immutability, readability, and testability. section 3.2.1 section 3.6
- A field injected this way cannot be final. section 3.2.1
