Skip to content

Commit 0b947ff

Browse files
Merge pull request #170 from zhonghuasheng/develop
docs(spring): update note of spring
2 parents 836e07a + 02dc4c8 commit 0b947ff

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,6 @@
241241
<h2 align="center">技术栈</h2>
242242
<center>
243243

244-
![](tutorial-2020-02-20.png)
244+
![](tutorial-2020-02-21.png)
245245

246246
</center>

java/spring/spring.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,28 @@
66
* [Spring历史版本变迁和如今的生态帝国](http://note.youdao.com/noteshare?id=80509c0296c54ccb86c1848b95c9c530&sub=wcp15565934311825)
77
* [手写一个Spring IOC的简单实现](https://github.com/zhonghuasheng/JAVA/tree/master/basic/src/main/java/com/zhonghuasheng/ioc)
88
* [什么是Spring]()
9-
* []()
10-
* []()
9+
* [Spring 依赖注入](http://note.youdao.com/noteshare?id=91ac0b573c1898e8fa3b47ebfdfffbf1&sub=wcp1582257498880783)
10+
* [Spring Java配置](http://note.youdao.com/noteshare?id=4808a867c7b646f7f4d41a1bbe2f79fa&sub=wcp1582272695540930)
11+
* [Spring Bean Scope](http://note.youdao.com/noteshare?id=f0c541d742d9548342dbca9e04607758&sub=wcp1582292894805554)
12+
* [Spring AOP与AspectJ的对比](http://note.youdao.com/noteshare?id=b75baf23ad8073d69527838449b259c1&sub=wcp1582290319293279)
13+
14+
15+
### 依赖注入
16+
Spring IoC容器(ApplicationContext)负责创建Bean,并通过容器将功能类Bean注入到你需要的Bean中。Spring提供使用xml,注解,Java配置,groovy配置实现Bean的创建和注入。
17+
无论是xml配置,注解配置还是Java配置,都被称为配置元数据,所谓元数据即描述数据的数据。元数据本身不具备任何可执行的能力,只能通过外界代码来对这些元数据行解析后进行一些有意义的操作。Spring容器解析这些配置元数据进行Bean初始化,配置和管理依赖。
18+
> 声明Bean的注解:
19+
@Component 组件,没有明确的角色。
20+
@Service 在业务逻辑层(service层)使用。
21+
@Repository 在数据访问层(dao层)使用。
22+
@Controller在展现层(MVC——>SpringMVC)使用。
23+
24+
> 注入Bean的注解,一般情况下通用
25+
@Autowired:Spring提供的注解。
26+
@Inject:JSR-330提供的注解。
27+
@Resource:JSR-250提供的注解。
28+
29+
@Autowired@Inject@Resource可注解在set方法或者属性上
1130

12-
`依赖注入`
1331
* [Spring依赖注入之Setter注入 - Setter Injection](https://github.com/zhonghuasheng/JAVA/tree/master/spring4/src/main/java/com/zhonghuasheng/spring4/springdiwithxmlexample/setterinject)
1432
* [Spring依赖注入之构造函数注入 - Constructor Injection](https://github.com/zhonghuasheng/JAVA/tree/master/spring4/src/main/java/com/zhonghuasheng/spring4/springdiwithxmlexample/constructorinject)
1533
* [Spring自动装配]() ***[byName](https://github.com/zhonghuasheng/JAVA/tree/master/spring4/src/main/java/com/zhonghuasheng/spring4/autowiringusingxml/autowirebyname)*** ***[byType](https://github.com/zhonghuasheng/JAVA/tree/master/spring4/src/main/java/com/zhonghuasheng/spring4/autowiringusingxml/autowirebytype)***

tutorial-2020-02-20.png

-473 KB
Binary file not shown.

tutorial-2020-02-21.png

238 KB
Loading

0 commit comments

Comments
 (0)