The task was supposed to be cosmetic. Forty Spring services still used @Autowired on private fields, the team had agreed constructor injection was the better default, and someone with a quiet sprint offered to convert them. It is the kind of change that tends to go in without much discussion, because it only moves dependencies from one place in a class to another. The application stopped starting after the third service. Spring refused with a message every Spring developer has seen at least once: the dependencies of some of the beans in the application context form a cycle. By the end of the conversion there were twelve of those cycles, and none of them was new.
They had been there all along, and what hid them was a single line of configuration. Since version 2.6, Spring Boot refuses circular references by default, whatever the injection style, so a cycle between two field-injected beans fails at startup too.…