Field injection can lead to less maintainable code and makes testing more difficult.
Field injection directly sets dependencies on fields using annotations like @Autowired, which can lead to code that's harder to test and maintain. It hides dependencies from the constructor, making the code less transparent and creating tight coupling to the Spring framework. In contrast, constructor injection exposes dependencies, making it easier to write unit tests. For instance, testing a ProductService with field injection might require setting up an application context, whereas constructor injection allows direct instantiation with mock dependencies.
Additional Notes
What are the design consequences of using field injection?