{"id":26407129,"url":"https://github.com/weizujie/mini-spring","last_synced_at":"2026-05-19T17:11:03.158Z","repository":{"id":208554187,"uuid":"426860895","full_name":"weizujie/mini-spring","owner":"weizujie","description":"手撸最简 spring 框架","archived":false,"fork":false,"pushed_at":"2021-11-17T10:23:23.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-11-22T04:33:52.169Z","etag":null,"topics":["aop","ioc","spring"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weizujie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-11-11T03:41:55.000Z","updated_at":"2023-11-22T04:33:56.246Z","dependencies_parsed_at":"2023-11-22T04:43:57.189Z","dependency_job_id":null,"html_url":"https://github.com/weizujie/mini-spring","commit_stats":null,"previous_names":["weizujie/mini-spring"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weizujie%2Fmini-spring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weizujie%2Fmini-spring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weizujie%2Fmini-spring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weizujie%2Fmini-spring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weizujie","download_url":"https://codeload.github.com/weizujie/mini-spring/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244077470,"owners_count":20394299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aop","ioc","spring"],"created_at":"2025-03-17T17:29:08.746Z","updated_at":"2026-05-19T17:10:58.137Z","avatar_url":"https://github.com/weizujie.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mini-spring\n\nspring 框架学习\n\n## spring-ioc\n\n### 说明\n\n根据 B 站 up 主：【楠哥教你学Java】的教学视频一步一步实现的基于注解的 Spring IoC 容器。\n\n### 参考资料\n\n- [bilibili-楠哥教你学Java-手写框架！3小时搞懂Spring IoC核心源码](https://www.bilibili.com/video/BV1AV411i7VH)\n\n\n### 实现思路\n\n1. 自定义一个 AnnotationConfigApplicationContext，构造器传入要扫描的包的全路径（如com.example.service）\n\n2. 获取到这个包下的所有类\n\n3. 遍历这些类，获取到有 @Component 注解的类，获取它的 Class 和对应的 beanName，封装成一个 BeanDefinition，存入 Set 集合。\n\n4. 遍历集合，通过反射机制创建对象，同时检测对象的属性有没有添加 @Value 注解，如果有就给这些属性赋值，再将这些动态创建的对象以 key-value 的形式存入缓存区（这里用 HashMap)\n\n5. 提供 getBean() 等方法，通过 beanName 取出对应的 bean\n\n## simple-spring\n\n### 说明\n\n- [x] 依赖注入\n- [x] BeanPostProcessor\n- [x] InitializingBean\n- [x] BeanNameAware\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweizujie%2Fmini-spring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweizujie%2Fmini-spring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweizujie%2Fmini-spring/lists"}