I have a complex set of beans and dependencies between them. All beans are @Service
, @Repository
or @Controller
annotated and I use the @PostConstruct
annotation. There are some circular dependencies but still the system was correctly initialized by Spring.
Then I added a simple Controller with just a dependency to one of the Services. Theoretically, the system should be able to boot because theoretically it could first set up the system as before and then the new Controller. But Spring complains that it cannot set up the context:
Error creating bean with name 'userService': Requested bean is currently in creation: Is there an unresolvable circular reference?
Can I somehow assists Spring in how to order the context initialization? I think the main issue is the userService
which is used a lot through the system for authentication purposes.