The org.springframework.beans.BeansException type could not be resolved. This indirectly refers to the required .class files
Hi i am facing problem with below error in eclipse please help to solve this problem.
Error message
The org.springframework.beans.BeansException type could not be resolved. This indirectly links to the required .class files
I imported the jar file (org.springframework.context-3.0.4.RELEASE) even then ran into this problem.
see below code (where i am getting error at ApplicationContext line appCtx = new ClassPa thanks mlApplicationContext ("applicationContext.xml");)
package com.csp.test.document;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.csp.model.Document;
import com.csp.service.DocumentService;
public class DocumentTest {
@Test
public void testGetDocument() {
ApplicationContext appCtx = new ClassPathXmlApplicationContext(
"applicationContext.xml");
DocumentService documentService = (DocumentService) appCtx
.getBean("documentService");
Document doc = documentService.getDocument(1);
String status = null;
if (doc != null) {
status = documentService.saveDocument(doc);
} else {
System.out.println("error in retreiving document");
}
assertEquals("Success Status", "SUCCESS", status);
}
}
source to share
If you do not use maven (or any other dependency management tool, for that matter), you must manually add spring-context
dependencies spring-beans
, spring-core
, spring-aop
and spring-expression
, of course, each of them has its own dependencies (Transitive Dependency). By the way, BeansException
is part of the modulespring-beans
source to share