I am trying to use spring-mvc-test framework to test my controller (name it MainController).
MainController has injected one service (OuterService) witch i want to mock in standolone test configuration. That service conteins another service as autowired field.
For my tests i am using context in java class witch looks like:
When i fire up my tests failed with exceptions like:Code:@Configuration public class MainControllerTestContext { @Bean public MainController mainController(){ return new MainController(); } @Bean(autowire=Autowire.NO) public OuterService outerService(){ return Mockito.mock(OuterService.class); } }
When i am using interfaces for that services it is everything ok. But i do not want to (I will have one and only one service with interface like this, so implementing interfece is useless).Code:Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mcg.services.dao.InnerService com.mcg.services.OuterService.innerService;
How to solve that problem... ?
Thanks in advance!


Reply With Quote
