上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 28 下一页
摘要: 1)bean: //@Component等价于<context:component-scan base-package="com.kakafa.pojo"/> @Component public class User { private String name; } <?xml version="1 阅读全文
posted @ 2022-01-06 14:46 卡卡发 阅读(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 @ 2022-01-06 13:58 卡卡发 阅读(39) 评论(0) 推荐(0)
摘要: 在Spring中由三种装配方式: xml中显式的配置 java中显式的配置 隐式的自动装配bean 1.环境搭建 Dog.java: package com.kakafa.pojo; public class Dog { public void shout(){ System.out.println 阅读全文
posted @ 2022-01-06 11:35 卡卡发 阅读(51) 评论(0) 推荐(0)
摘要: 1.单例模式singleton:全局共享一个bean对象 单例模式举例理解:比如目前程序的配置对象,全局只需要一个就可以,使用时get,修改后也会同时影响其他位置 2.原型模式prototype:每次getBean()都会产生一个新对象 3.其余的request,session,applicatio 阅读全文
posted @ 2022-01-06 10:56 卡卡发 阅读(43) 评论(0) 推荐(0)
摘要: 依赖:bean对象的创建依赖于容器 注入:bean对象中所有属性由容器来注入 DI注入的几种方式: 构造器注入-详见:https://www.cnblogs.com/kakafa/p/15753718.html set方式注入(重点) 其他拓展方式注入 可以利用p命名空间和c命名空间进行注入 set 阅读全文
posted @ 2022-01-06 10:25 卡卡发 阅读(38) 评论(0) 推荐(0)
摘要: 1.别名 2.bean id:bean的名字,相当于对象名 class:bean对象对应的类型 name:也是别名,而且name可以同时取多个别名,多个别名用逗号或者空格或者分号隔开 3.import 一般用于团队开发,可以将多个配置文件导入为一个 阅读全文
posted @ 2022-01-06 08:46 卡卡发 阅读(31) 评论(0) 推荐(0)
摘要: 1.无参构造创建 2.有参构造创建-第一种利用下标index public User(String name) { this.name = name; } public void show(){ System.out.println("name="+name); } <bean id="user" 阅读全文
posted @ 2021-12-31 16:48 卡卡发 阅读(39) 评论(0) 推荐(0)
摘要: 1.IOC本质 2.HelloSpring Hello.java: package com.kakafa.pojo; public class Hello { private String str; public String getStr() { return str; } public void 阅读全文
posted @ 2021-12-31 15:27 卡卡发 阅读(69) 评论(0) 推荐(0)
摘要: Spring官方文档:https://docs.spring.io/spring-framework/docs/current/reference/html/index.html Spring中文文档:https://www.docs4dev.com/docs/zh/spring-framework 阅读全文
posted @ 2021-12-30 14:56 卡卡发 阅读(59) 评论(0) 推荐(0)
摘要: MyBatis缓存 (1)一级缓存 1.查询两次相同的数据 测试: @Test public void test(){ SqlSession sqlSession = MybatisUtils.getSqlSession(); UserMapper mapper = sqlSession.getMa 阅读全文
posted @ 2021-12-24 13:31 卡卡发 阅读(51) 评论(0) 推荐(0)
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 28 下一页