You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

CPS-738 - Getting issue details... STATUS


Issue Reported:

Application start up failing due to cyclic dependency :

┌─────┐
|  notificationService defined in URL
[jar:file:/app/libs/cps-service-2.0.1-SNAPSHOT.jar!/org/onap/cps/notification/NotificationService.class]
↑     ↓
|  cpsDataUpdatedEventFactory defined in URL
[jar:file:/app/libs/cps-service-2.0.1-SNAPSHOT.jar!/org/onap/cps/notification/CpsDataUpdatedEventFactory.class]
↑     ↓
|  cpsDataServiceImpl (field private
org.onap.cps.notification.NotificationService
org.onap.cps.api.impl.CpsDataServiceImpl.notificationService)
└─────┘

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, 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.

Instead of going back to cpsDataServiceImpl for making calls to persistence layer, make a direct call to persistence layer from NotificationService.


Proposal 2:

Lazy Intitialization of cpsDataServiceImpl in cpsDataUpdatedEventFactory component. The lazy initialization concept simply means initialize something when needed. So lazy initialization of bean means bean will be initialized at the time of its demand instead of start up. This will help in resolving the cyclic dependency at start up.



  • No labels