在controller中使用@resource或者@autowire注解注入service
第一步:在web.xml中的context-parm标签中加载applicationContext.xml文件
第二步:在applicationContext.xml中扫描service所在的包
第三步:在需要注入的service中加上@service注解
第四步:在controller中在需要注入的service上加上@Resource或者@Autowire就可以了
第一步:在web.xml中的context-parm标签中加载applicationContext.xml文件
第二步:在applicationContext.xml中扫描service所在的包
第三步:在需要注入的service中加上@service注解
第四步:在controller中在需要注入的service上加上@Resource或者@Autowire就可以了