Hello
1)
@Controller
public class HomeController {
public static final int DEFAULT_SPITTLES_PER_PAGE = 25;
private SpitterService spitterService;
@Inject
public HomeController(SpitterService spitterService) {
this.spitterService = spitterService;
}
Could the @Inject annotation have been specified on the private instance variable:
@Inject
private SpitterService spitterService;
And drop the Contructor as a zero-lenth contructor is created automatically
2) Does the @Controller annotation give anything above and beyond the @Component annotation like @Repository?
3) Mockito
Suppose I had defined @Autowired on the private variable in HomeController:
@Autowired
private SpitterService spitterService;
public HomeController(){}
How would I mock the SpitterService in HomeControllerTest and inject it into the HomeController?
Thanks
Mark
|