spring项目启动需要的几个注解

1.@ComponentScan注解,spring context包下,可以理解嘛,扫描srping bean放在ioc容器中的。

ApplicationContext是接口,就是IOC容器嘛,也在这个包下。spring-context.jar包下。

如:

@ComponentScan(basePackages = "com.pingan.property.icore.pap.*")

 

2.@Configuration注解,也在spring-context.jar包下。用于注册bean到ioc容器中,@Configuration注解里面必须包含@Bean注解。

同样,@configure是将bean注册到ioc容器中的,当然也都要在spring-context.jar包下了
posted @ 2017-07-31 17:26  跨境电商杂货铺  阅读(341)  评论(0编辑  收藏  举报