스프링 - 휴식, 비즈니스 로직 및 데이터베이스 작업에 3 개의 계층 적 레이어가 삽입되었습니다. BL 및 DAO에 대한 Junit 테스트는 비즈니스 로직 ioc 계층 만 주입 할 수있는 경우 정상적으로 작동합니다. JUnit 테스트에 대한Spring & Struts2 REST - junit tests
는내 저녁 식사 클래스 :
import org.springframework.test.AbstractTransactionalSpringContextTests;
public class AbstractTest extends AbstractTransactionalSpringContextTests {
protected static final String path = "config/spring/applicationContext.xml";
/**
* Disabled autowire by type
* Disabled dependency check
*/
public AbstractTest() {
super();
this.setAutowireMode(AUTOWIRE_BY_NAME);
this.setDependencyCheck(false);
}
@Override
protected String[] getConfigLocations() {
return new String[] {
path
};
}
}
그래서 - 나머지는 비즈니스 로직을 호출하고이 데이터베이스 작업을 호출합니다. Nullpointer 예외는 데이터베이스 호출의 비즈니스 논리에 해당합니다. 예와
상세 정보 : REST : getUserDAO Nullpointer이 getUserBO 방법에 getUserDAO에 발생합니다
(ID) : getUserBO (ID) DAO를 호출 인 getUser (ID)는 BL 호출. 이는 배포 된 junit 테스트에서만 발생합니다.
어떤 메소드가 NullPointerException을 던지고 있습니까? –
질문을 편집했습니다. – Trick