...
Why the cyclic dependency is there :
CpsDataServiceImpl : Service component making calls to persistence layer.
CpsDataUpdateddEventFactory : Service component to initiate the Notification
NotificationService:
Spring by default performs the bean initialization at the startup of the application. Hence cyclic dependencies lead to issues.
Proposal 1:
At present, cps-temporal always sends the entire data. When a patch update is made to the data in cps, :
CpsDataServiceImpl publishes the updated data to NotificationService.
NotificationServices again makes a call to CPSDataServiceImpk, a query is made from the NotificationService - cpsDataUpdatedEventFactory - cpsDataServiceImpl.getAnchors(). And then the entire data is obtained from cps and then sent back to NotificationService for publishing to cps-temporal.
This has led to the cyclic dependency.
Spring by default performs the bean initialization at the startup of the application. Hence cyclic dependencies lead to issues because each components keep waiting for its dependencies to be initialized first.
Proposal 1:
Instead of going back to cpsDataServiceImpl for making calls to persistence layer, make a direct call to persistence layer from NotificationService.
...