您好在Eclipse中面临以下错误的问题请帮助解决此问题.
错误信息
无法解析org.springframework.beans.BeansException类型.它是从所需的.class文件间接引用的
我导入了jar文件(org.springframework.context-3.0.4.RELEASE),即便面对这个问题.
看下面的代码(在哪里遇到问题ApplicationContext appCtx = new ClassPathXmlApplicationContext("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);
}
}
Run Code Online (Sandbox Code Playgroud)