springMVC的@Autowired

来源:互联网 发布:阿佳妮 知乎 编辑:程序博客网 时间:2024/06/03 16:44

1,在springMVC框架中的controller,dao,service中在controlle中@Controller,dao中@Repository,service中@Service否则无法注入。会报:Injection of autowired dependencies failed

2,在springMVC框架中@Autowired,加载的方法时,里面的只能传递方法。同时,如果传递参数时,必须在引用时初始化。

0 0
原创粉丝点击