mybatis一对一,一对多,多对多实现方式
摘要:1.原始方式 /** * 测试使用QueryVo作为查询条件 */ @Test public void testFindByVo(){ QueryVo vo = new QueryVo(); User user = new User(); user.setUserName("%王%"); vo.se
阅读全文
posted @
2020-08-31 00:35
从精通到陌生
阅读(808)
推荐(0) 编辑
mybatis通过代理类和实现类的crud操作
摘要:1.mybatis配置xml通过代理模式获取数据 public class MybatisTest { /** * 入门案例 * @param args */ public static void main(String[] args)throws Exception { //1.读取配置文件 In
阅读全文
posted @
2020-08-29 17:41
从精通到陌生
阅读(212)
推荐(0) 编辑
spring通知
摘要:1.最简单通知配置 /** * 测试AOP的配置 */ public class AOPTest { public static void main(String[] args) { //1.获取容器 ApplicationContext ac = new ClassPathXmlApplicati
阅读全文
posted @
2020-08-26 23:23
从精通到陌生
阅读(311)
推荐(0) 编辑
Spring动态代理和cglib代理实现
摘要:1.基于jdk动态代理实现方式 /** * 模拟一个消费者 */ public class Client { public static void main(String[] args) { final Producer producer = new Producer(); /** * 动态代理:
阅读全文
posted @
2020-08-26 18:50
从精通到陌生
阅读(272)
推荐(0) 编辑
spring初步
摘要:1.强依赖关系 public class JdbcDemo1 { public static void main(String[] args) throws SQLException, ClassNotFoundException { //1.注册驱动 // DriverManager.regist
阅读全文
posted @
2020-08-26 13:13
从精通到陌生
阅读(136)
推荐(0) 编辑
spring基于xml和注解配置事务
摘要:1.基于xml的spring事务 /** * 使用Junit单元测试:测试我们的配置 */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:bean.xml") public c
阅读全文
posted @
2020-08-26 00:46
从精通到陌生
阅读(319)
推荐(0) 编辑
强软弱虚四大引用
摘要:1.强引用 当内存不足,JVM开始垃圾回收,对于强引用的对象,就算是出现了OOM也不会对该对象进行回收,死都不收。 强引用是我们最常见的普遍对象引用,只要还有强引用指向一个对象,就能表明对象还活着,垃圾收集器不会碰这种对象。在JAVA最常见的就是强引用,把一个对象赋给一个引用变量就是一个强引用。当一
阅读全文
posted @
2020-08-22 12:45
从精通到陌生
阅读(441)
推荐(0) 编辑
线程通信的几种实现方式
摘要:1. Synchronized方式 package com.hourui.validate.Test3; public class TestSynchronizedWaitNotify { public static void main(String[] args) { final Object o
阅读全文
posted @
2020-08-18 00:17
从精通到陌生
阅读(249)
推荐(0) 编辑
java8新特性之方法引用和构造器引用
摘要:@RunWith(SpringRunner.class) @SpringBootTest public class TestMethod { /** * 一,方法引用:若Lambda体中的内容有方法已经实现了,我们可以使用“方法引用” * (可以理解为方法引用是Lambda表达式的另一种表现形式)
阅读全文
posted @
2020-08-03 00:25
从精通到陌生
阅读(197)
推荐(0) 编辑
JAVA四大内置函数
摘要:/** * Consumer<T> : 消费型接口 * void accept(T t); * * Supplier<T> : 供给型接口 * T get(); * * Function<T, R> : 函数型接口 * R apply(T t); * * Predicate<T> : 断言型接口 *
阅读全文
posted @
2020-08-02 23:54
从精通到陌生
阅读(1220)
推荐(0) 编辑
JAVA四大内置函数
摘要:/** * Consumer<T> : 消费型接口 * void accept(T t); * * Supplier<T> : 供给型接口 * T get(); * * Function<T, R> : 函数型接口 * R apply(T t); * * Predicate<T> : 断言型接口 *
阅读全文
posted @
2020-08-02 23:50
从精通到陌生
阅读(232)
推荐(0) 编辑