title: Issue with testing Spring MVC slice in SpringBoot 1.4
body: <p>I'm trying out the new Spring Boot 1.4 MVC testing features. I have the following controller.</p>
  
  <pre><code>@Controller
  public class ProductController {
  
    private ProductService productService;
  
    @Autowired
    public void setProductService(ProductService productService) {
      this.productService = productService;
    }
  
    @RequestMapping(value = "/products", method = RequestMethod.GET)
    public String list(Model model){
      model.addAttribute("products", productService.listAllProducts());
       return "products";
    }
  }
  </code></pre>
  
  <p>My minimal ProductService implementation is:</p>
  
  <pre><code>@Service
  public class ProductServiceImpl implements ProductService {
    private ProductRepository productRepository;
  
    @Autowired
    public void setProductRepository(ProductRepository productRepository) {
      this.productRepository = productRepository;
    }
  
    @Override
    public Iterable&lt;Product&gt; listAllProducts() {
      return productRepository.findAll();
    }
  
  }
  </code></pre>
  
  <p>The code of ProductRepository is:</p>
  
  <pre><code>public interface ProductRepository extends CrudRepository&lt;Product,    
   Integer&gt;{
  }
  </code></pre>
  
  <p>I'm trying to use the new @WebMvcTest to test the conroller. My view is a thymeleaf teamplate. And my controller test is this:</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @WebMvcTest(ProductController.class)
  
  public class ProductControllerTest {
  private MockMvc mockMvc;
  
  @Before
  public void setUp() {
      ProductController productController= new ProductController();       
      mockMvc = MockMvcBuilders.standaloneSetup(productController).build();
  }
  
  @Test
  public void testList() throws Exception {        
  mockMvc.perform(MockMvcRequestBuilders.get("/products"))                 
  .andExpect(MockMvcResultMatchers.status().isOk())                
  .andExpect(MockMvcResultMatchers.view().name("products"))             
   .andExpect(MockMvcResultMatchers.model().attributeExists("products"));               
   }
  }
  </code></pre>
  
  <p>But, on running the test I get this error.</p>
  
  <pre><code>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'productController': Unsatisfied dependency expressed through method 'setProductService' parameter 0: No qualifying bean of type [guru.springframework.services.ProductService] found for dependency [guru.springframework.services.ProductService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [guru.springframework.services.ProductService] found for dependency [guru.springframework.services.ProductService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
  </code></pre>
  
  <p>I need help to resolve the issue to properly test ProductController. Suggestions for additional <strong>andExpect()</strong> for more thorough testing of the controller will be highly appreciated.</p>
  
  <p>Thanks in advance.  </p>