首页 > 编程语言 > 详细

Spring知识点回顾(01)

时间:2017-09-20 09:52:54      阅读:252      评论:0      收藏:0      [点我收藏+]

Spring知识点回顾(01)

一、依赖注入

1、声明Bean的注解

@Component

@Service

@Repository

@Controller

2、注入Bean的注解

@Autowired

@Inject

@Resource

二、加载Bean

1、xml方式 - applicationcontext.xml : Beans, Bean, Component-Scan

技术分享

2、注解方式 - @Configuration,@ComponentScan,@Bean

用@Configuration注解该类,等价于XML中配置beans;用@Bean标注方法等价于XML中配置bean。

技术分享

3、测试代码

技术分享

Spring知识点回顾(01)

原文:http://www.cnblogs.com/lexiaofei/p/7559638.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!