java.lang.IllegalStateException: Failed to load ApplicationContext

Hello all;

Am failing to run tests with Junit with my IDE
When I look into my stack trace this is what I see

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘org.openelisglobal.audittrail.dao.AuditTrailService’ available: expected at least 1 bean which qualifies as autowire candidate.

i have done a maven build and it passed well, and I cant find any similar issue related to it

@reagan @Moses_Mutesasira

it is showing the bean for audit trail is missing ,make sure you implement or declare the bean for audittrailservice in your spring configuration

could you share the whole error log possibly through pastebin so that we can take a look at entirely

Hello @Agaba_Derrick_Junior can you please try this ? add the auditTrail package org.openelisglobal.audittrai into the configuration.

Kindly let me know if this helps.

hello @valens @ravi @segujja_joseph thanks for the help, I managed to solve that error it was due to the organisation of my test class, however there seem to be a bothering issue,

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.openelisglobal.TestNotificationServiceTest.TestNotificationServiceImplIntegrationTest’: Unsatisfied dependency expressed through field ‘testNotificationServiceImpl’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘org.openelisglobal.notification.service.TestNotificationServiceImpl’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

I’m working on the notification service tests, and there seems to be a missing bean or a bean not being able to be included in component scanning while running the test

@Agaba_Derrick_Junior regarding the solution I proposed above, please do the same for notificationService package.