46.3.18 자동 구성된 Data Redis 테스트들

@DataRedisTest를 사용하여 Redis 응용 프로그램을 테스트 할 수 있습니다. 기본적으로 @RedisHash 클래스를 검사하고 Spring Data Redis 저장소를 구성합니다. 일반 @Component 빈은 ApplicationContext로 로드되지 않습니다. (Spring Boot에서 Redis 사용에 관한 더 자세한 정보는이 장 앞부분의 "Section 32.1, “Redis"절을 참조하십시오.)

Redis : NoSQL의 일종. Remote Dictionary Server

@DataRedisTest에 의해 활성화되는 자동 구성 설정 목록은 부록에서 찾을 수 있습니다.

다음 예제는 사용중인 @DataRedisTest 어노테이션을 보여줍니다.

import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.data.redis.DataRedisTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@DataRedisTest
public class ExampleDataRedisTests {

	@Autowired
	private YourRepository repository;

	//
}

Last updated