摘要: 来源:力扣(LeetCode) 链接:https://leetcode.cn/problems/add-two-numbers 给你两个 非空 的链表,表示两个非负的整数。它们每位数字都是按照 逆序 的方式存储的,并且每个节点只能存储 一位 数字。 请你将两个数相加,并以相同形式返回一个表示和的链表 阅读全文
posted @ 2022-07-16 21:30 xy7112 阅读(72) 评论(0) 推荐(0)
摘要: 按类型装配的步骤 查看需要的类型是否为 Optional,是,则进行封装(非延迟),否则向下走 查看需要的类型是否为 ObjectFactory 或 ObjectProvider,是,则进行封装(延迟),否则向下走 查看需要的类型(成员或参数)上是否用 @Lazy 修饰,是,则返回代理,否则向下走 阅读全文
posted @ 2022-07-16 15:48 xy7112 阅读(70) 评论(0) 推荐(0)
摘要: 点击查看代码 ConfigurableApplicationContext context = SpringApplication.run(A45.class, args); Bean1 proxy = context.getBean(Bean1.class); /* 1.演示 spring 代理的 阅读全文
posted @ 2022-07-16 14:58 xy7112 阅读(26) 评论(0) 推荐(0)
摘要: 项目中,只需要加入以下依赖即可 在编译期扫描结束 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-indexer</artifactId> <optional>true</optional> 阅读全文
posted @ 2022-07-16 14:46 xy7112 阅读(62) 评论(0) 推荐(0)
摘要: 点击查看代码 AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(A43.class); Bean1 bean1 = (Bean1) context.getBean("bean1"); 阅读全文
posted @ 2022-07-16 14:34 xy7112 阅读(22) 评论(0) 推荐(0)
摘要: 条件装配的底层是本质上是 @Conditional 与 Condition,这两个注解。引入自动配置类时,期望满足一定条件才能被 Spring 管理,不满足则不管理,怎么做呢? 比如条件是【类路径下必须有 dataSource】这个 bean ,怎么做呢? 首先编写条件判断类,它实现 Conditi 阅读全文
posted @ 2022-07-16 13:41 xy7112 阅读(38) 评论(0) 推荐(0)