small-spring icon indicating copy to clipboard operation
small-spring copied to clipboard

🌱《 Spring 手撸专栏》,本专栏以 Spring 源码学习为目的,通过手写简化版 Spring 框架,了解 Spring 核心原理。在手写的过程中会简化 Spring 源码,摘取整体框架中的核心逻辑,简化代码实现过程,保留核心功能,例...

Results 24 small-spring issues
Sort by recently updated
recently updated
newest added

执行jdk代理invoke方法时,此处总是返回false; if (advised.getMethodMatcher().matches(method, advised.getTargetSource().getTarget().getClass())) { MethodInterceptor methodInterceptor = advised.getMethodInterceptor(); return methodInterceptor.invoke(new ReflectiveMethodInvocation(advised.getTargetSource().getTarget(), method, args)); } 原因是使调用matches()f方法时;jdk传入的方法是接口的抽法, ()pointcutExpression.matchesMethodExecution(method).alwaysMatches(); 这儿改用方法名和形参个数进行方法的匹配,jdk方法拦截正常 if (matches(targetClass)) { Method[] declaredMethods = targetClass.getDeclaredMethods(); for (Method declaredMethod : declaredMethods)...

1. ConfigurableListableBeanFactory#addBeanPostProcessor 接口方法可以删掉,不需要

修改small-spring-step-17下的pom org.apache.maven.plugins maven-compiler-plugin 3.1 1.8 1.8 UTF-8 -Xlint:deprecation ${java.home}\lib\rt.jar;${java.home}\lib\jce.jar

![image](https://user-images.githubusercontent.com/38028486/144955057-fbae8c11-b67b-46f7-afb7-84e19f639b80.png)

![image](https://user-images.githubusercontent.com/33884166/147455394-2c7b5270-f7da-4cba-9a6b-3b867bb665c3.png)

第6条-核心类实现(DefaultSingletonBeanRegistry)----------DefaultListableBeanFactory 实现BeanDefinitionRegistry接口,但文章的前面的出现这个接口的创建

1. 删除ConfigurableListableBeanFactory接口中的重复定义的方法addBeanPostProcessor 2. pom中引入validation-api依赖,将@Nullable注解的引用类从com.sun.istack.internal切换为org.jetbrains.annotations 3. 优化.gitignore 忽略所有的.iml和class文件

![df2f7e47e27d89fd24e4aad3a5d6b26](https://user-images.githubusercontent.com/57940720/149861164-a8a8318d-9061-417c-a82a-dcb250b45c88.png)

![1642473190](https://user-images.githubusercontent.com/57940720/149860891-3cdff29c-040f-429a-9389-551498aca751.jpg) ![1642473190(1)](https://user-images.githubusercontent.com/57940720/149860928-a0cd591b-b2b5-4d85-975b-96fe030a9ff7.jpg)