使用的引入注解不同
(引入controller的时候有时候会拿不到,那是因为controller类的最上面,没有引入@Controller注解:)
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:spring/spring-mvc.xml" })
public class xxxTest {
@Resource
private xxxController nikeBuyController;
@Resource
private xxxService xxxService;
@Autowired
private HttpServletRequest request;
@Autowired
private HttpServletResponse response;
}
controller与service层用的注解不一样。但有时候都是@Resource 为什么会这个原因我也不太明白,懂的老师希望告诉我一下。谢谢