摘要: applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/ 阅读全文
posted @ 2021-04-08 11:36 川上富江 阅读(31) 评论(0) 推荐(0)
摘要: Client.class public class Client { public static void main(String[] args) { //真实角色 Host host = new Host(); //代理角色 现在没有 ProxyInvoationHandle pih = new 阅读全文
posted @ 2021-04-08 10:25 川上富江 阅读(35) 评论(0) 推荐(0)
摘要: @Autowired 自动装配通过类型 名字 如果@Autowired不能唯一自动装配上属性,则需要@Qualifier(value="xxx") @Nullable 字段标记了这个注解 说明这个字段可以为Null @Resource 自动装配 名字 类型 @Component 组件 放在类上 说明 阅读全文
posted @ 2021-04-07 14:55 川上富江 阅读(44) 评论(0) 推荐(0)
摘要: 自动装配说明 自动装配是使用spring满足bean依赖的一种方法 spring会在应用上下文中为某个bean寻找其依赖的bean。 Spring中bean有三种装配机制,分别是: 在xml中显式配置; 在java中显式配置; 隐式的bean发现机制和自动装配。 这里我们主要讲第三种:自动化的装配b 阅读全文
posted @ 2021-04-07 14:38 川上富江 阅读(223) 评论(0) 推荐(0)
摘要: 单例模式(spring默认机制) 原型模式:每次从容器中get的时候都会 产生一个新对象 阅读全文
posted @ 2021-04-06 22:17 川上富江 阅读(45) 评论(0) 推荐(0)
摘要: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 阅读全文
posted @ 2021-04-06 20:53 川上富江 阅读(36) 评论(0) 推荐(0)
摘要: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 阅读全文
posted @ 2021-04-06 19:37 川上富江 阅读(55) 评论(0) 推荐(0)
摘要: xml文件 <settings> <setting name="logImpl" value="STDOUT_LOGGING"/> <!-- 是否开启驼峰命名自动映射,即从经典数据库列名 A_COLUMN 映射到经典 Java 属性名 aColumn--> <setting name="mapUnd 阅读全文
posted @ 2021-04-03 18:15 川上富江 阅读(31) 评论(0) 推荐(0)
摘要: 1. 测试环境搭建 多个学生一个老师; alter table student ADD CONSTRAINT fk_tid foreign key (tid) references teacher(id)1. 测试环境搭建2.导入lombok3.新建实体类Teacher,Student4.建立Map 阅读全文
posted @ 2021-03-31 20:30 川上富江 阅读(62) 评论(1) 推荐(0)