Skip to content

Commit

Permalink
add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
xichuan committed Nov 17, 2022
1 parent 244a87f commit c65a9fb
Show file tree
Hide file tree
Showing 7 changed files with 1,418 additions and 15 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
博文列表:
- [手写spring之ioc](https://github.com/Raray-chuan/mini-spring/tree/main/doc/手写spring之ioc.md)
- [手写spring之aop](https://github.com/Raray-chuan/mini-spring/tree/main/doc/手写spring之aop.md)
- [手写spring之springmvc](https://github.com/Raray-chuan/mini-spring/tree/main/doc/手写spring之springmvc.md)
- [手写spring之内嵌tomcat](https://github.com/Raray-chuan/mini-spring/tree/main/doc/手写spring之内嵌tomcat.md)
- [手写spring之简单实现springboot](https://github.com/Raray-chuan/mini-spring/tree/main/doc/手写spring之简单实现springboot.md)



Expand Down
16 changes: 13 additions & 3 deletions doc/手写spring之aop.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,19 @@ public class MethodNode {
}
```


## 5.实现AOP的过程
### 5.1 LoadBeanHelper.loadAllBeanDefinition()

对ioc的实现已经讲过了,请转下面链接进行阅读


- [手写spring之ioc](https://github.com/Raray-chuan/mini-spring/tree/main/doc/手写spring之ioc.md)


下面会将到只会对LoadBeanHelper中与aop相关的代码进行说明



### 5.1 LoadBeanHelper.loadAllBeanDefinition()中处理含有@Aspect注解的类
```java
public static void loadAllBeanDefinition() {
for (Class<?> clazz : classesHashSet) {
Expand Down Expand Up @@ -393,7 +403,7 @@ public class MethodAspect {



### 5.2 LoadBeanHelper.productBean
### 5.2 LoadBeanHelper.productBean:对需要增强的类创建动态代理对象
此方法会实例化类,们进入此方法看如果对需要增强的类创建动态代理对象
```java
/**
Expand Down
9 changes: 4 additions & 5 deletions doc/手写spring之ioc.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ public class BeanDefinition {
```


### 4.3 BeanContainer
存放三级缓存的类
### 4.3 BeanContainer 存放三级缓存的类
```java
/**
* @Author Xichuan
Expand Down Expand Up @@ -234,7 +233,7 @@ public class SpringContext {



### 5.2 LoadBeanHelper.loadAllClass
### 5.2 LoadBeanHelper.loadAllClass 加载所有的class
```java
/**
*获取packagePath下的所有class
Expand Down Expand Up @@ -264,7 +263,7 @@ public class SpringContext {



### 5.3 LoadBeanHelper.loadAllBeanDefinition
### 5.3 LoadBeanHelper.loadAllBeanDefinition,将class封装成BeanDefinition
```java
/**
* 将所有的BeanDefinition放入map中,(只有@Component、@Controller、@Service、@Repository才会放入)
Expand Down Expand Up @@ -321,7 +320,7 @@ public class SpringContext {



### 5.4 LoadBeanHelper.productBean()
### 5.4 LoadBeanHelper.productBean() 将所有BeanDefinition实例化成对象
```java
/**
* 生产单例bean,将需要代理的bean进行代理,放到一级缓存中
Expand Down
Empty file removed doc/手写spring之springmvc.md
Empty file.
Empty file removed doc/手写spring之内嵌tomcat.md
Empty file.
Loading

0 comments on commit c65a9fb

Please sign in to comment.