在context中配置

如:在base-package指明一个包:

<context:component-scan base-package="cn.edu.dao"/>
表明cn.gacl.java包及其子包中,如果某个类的头上带有特定的注解

@Component,@Repository,@Service,@Controller,就会将这个对象作为Bean注册进Spring容器。

 

在<context:component-scan base-package=” ”/>中指定多个包:

<context:component-scan base-package="cn.edu.dao.impl,cn.edu.service.impl,cn.edu.action"/>

多个包逗号隔开。

 

转:http://blog.csdn.net/jiangxindu1/article/details/46484441

相关文章:

  • 2022-03-01
  • 2021-10-23
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
  • 2021-12-18
猜你喜欢
  • 2022-12-23
  • 2021-06-01
  • 2021-08-27
相关资源
相似解决方案