Unfortunately, I've recently become responsible for a Spring project because our Spring expert left for greener pastures. "Unfortunately" because while I know Java well, I know little about Spring except its basic principles and I'm expected to continue quickly advancing this project.
I'm blocked by this exception
Cannot invoke "org.springframework.context.ApplicationContext.getBean(java.lang.Class)" because "this.applicationContext is null"
which is raised when running this unit test
@Test
public void testAnalyzeMetadata() throws DataException, IOException, BadJSONException {
new IRWMetadataAnalyzer().analyzeMetadata( 10, "no file");
}
The test class is annotated with
@ActiveProfiles("test")
@DataJdbcTest
@AutoConfigureTestDatabase(replace=AutoConfigureTestDatabase.Replace.NONE)
@Commit
@ComponentScan(basePackages = {"org.ms.IRWMetadataIntegration"})
like other test classes and methods that don't raise this exception.
Reviewing the project, I don't find any initialization of applicationContext
in the working tests and code under test, so that clearly happens "under the sheets". But I cannot determine where or how.
What I really need is a great consultant / trainer, but SO is my best alternative for now.
Thanks
Arthur