上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 18 下一页
摘要: ApplicationContext具有发布事件的能力。这是因为该接口继承了ApplicationEventPublisher接口。Spring中与事件有关的接口和类主要包括ApplicationEvent、ApplicationListener。定义一个事件的类需要继承ApplicationEve 阅读全文
posted @ 2020-09-15 00:02 从精通到陌生 阅读(11626) 评论(0) 推荐(1)
摘要: 1.延迟加载和立即加载 public class AccountTest { private InputStream in; private SqlSessionFactory factory; private SqlSession session; private IAccountDao acco 阅读全文
posted @ 2020-09-02 14:28 从精通到陌生 阅读(218) 评论(0) 推荐(0)
摘要: 1、Mybatis中的延迟加载 问题:在一对多中,当我们有一个用户,它有100个账户。 在查询用户的时候,要不要把关联的账户查出来? 在查询账户的时候,要不要把关联的用户查出来? 在查询用户时,用户下的账户信息应该是,什么时候使用,什么时候查询的。 在查询账户时,账户的所属用户信息应该是随着账户查询 阅读全文
posted @ 2020-09-02 11:41 从精通到陌生 阅读(238) 评论(0) 推荐(0)
摘要: 1.原始方式 /** * 测试使用QueryVo作为查询条件 */ @Test public void testFindByVo(){ QueryVo vo = new QueryVo(); User user = new User(); user.setUserName("%王%"); vo.se 阅读全文
posted @ 2020-08-31 00:35 从精通到陌生 阅读(827) 评论(0) 推荐(0)
摘要: 1.mybatis配置xml通过代理模式获取数据 public class MybatisTest { /** * 入门案例 * @param args */ public static void main(String[] args)throws Exception { //1.读取配置文件 In 阅读全文
posted @ 2020-08-29 17:41 从精通到陌生 阅读(231) 评论(0) 推荐(0)
摘要: 1.最简单通知配置 /** * 测试AOP的配置 */ public class AOPTest { public static void main(String[] args) { //1.获取容器 ApplicationContext ac = new ClassPathXmlApplicati 阅读全文
posted @ 2020-08-26 23:23 从精通到陌生 阅读(328) 评论(0) 推荐(0)
摘要: 1.基于jdk动态代理实现方式 /** * 模拟一个消费者 */ public class Client { public static void main(String[] args) { final Producer producer = new Producer(); /** * 动态代理: 阅读全文
posted @ 2020-08-26 18:50 从精通到陌生 阅读(279) 评论(0) 推荐(0)
摘要: 1.强依赖关系 public class JdbcDemo1 { public static void main(String[] args) throws SQLException, ClassNotFoundException { //1.注册驱动 // DriverManager.regist 阅读全文
posted @ 2020-08-26 13:13 从精通到陌生 阅读(156) 评论(0) 推荐(0)
摘要: 1.基于xml的spring事务 /** * 使用Junit单元测试:测试我们的配置 */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:bean.xml") public c 阅读全文
posted @ 2020-08-26 00:46 从精通到陌生 阅读(332) 评论(0) 推荐(0)
摘要: 1.强引用 当内存不足,JVM开始垃圾回收,对于强引用的对象,就算是出现了OOM也不会对该对象进行回收,死都不收。 强引用是我们最常见的普遍对象引用,只要还有强引用指向一个对象,就能表明对象还活着,垃圾收集器不会碰这种对象。在JAVA最常见的就是强引用,把一个对象赋给一个引用变量就是一个强引用。当一 阅读全文
posted @ 2020-08-22 12:45 从精通到陌生 阅读(507) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 18 下一页