Spring boot Test 方法启动异常

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.boot.test.web.client.TestRestTemplate] found for dependency [org.springframework.boot.test.web.client.TestRestTemplate]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

以下是我的test方法

 package com.hyh;

import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest(classes=SampleController.class)
public class Test01 {

    private Logger log = Logger.getLogger(getClass());


    @Autowired
    private TestRestTemplate restTemplate;


    @Test
    public void contextLoads() {
        log.info("in the test method");

        this.restTemplate.getForEntity("/", String.class, "Phil");
    }
}

http://blog.csdn.net/kkgbn/article/details/52120139