Spring常用注解
2022-04-15
评论 0
浏览64
本文内容纲要:-使用注解来构造IoC容器-1、@Component-2、@Controller-3、@Service-4、@Repository使用注解来构造IoC容器用注解来向Spring容器注册Bean。需要在applicationContext.xml中注册**<context:component-scanbase-package=”pagkage1[,pagkage2,…,pagkageN]”/>**。如:在base-package指明一个包1<context:component-scanbase-package="cn.gacl.java"/>表明cn.gacl.java包及其子包中