摘要: Maven依赖 <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency 阅读全文
posted @ 2021-03-30 09:28 ttpfx 阅读(38) 评论(0) 推荐(0) 编辑
摘要: AOP术语 通知 Advice : 切面的工作。通知定义了切面是什么,以及何时使用。 前置通知 Before 后置通知 After : 无论是否抛出异常都会调用 返回通知 After-returing :方法正常执行无异常之后调用 异常通知 After-throwing : 在目标方法抛出异常后调用 阅读全文
posted @ 2021-03-25 17:40 ttpfx 阅读(55) 评论(0) 推荐(0) 编辑
摘要: 安装spring-test和junit依赖,其中junit依赖的版本不低于4.12 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>5.3.4</ver 阅读全文
posted @ 2021-03-25 17:39 ttpfx 阅读(53) 评论(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 阅读全文
posted @ 2021-03-25 17:38 ttpfx 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 通过构造函数注入 <bean id="accountDao" class="com.ttpfx.dao.impl.AccountDaoImpl"/> <bean id="accountService" class="com.ttpfx.service.impl.AccountServiceImpl" 阅读全文
posted @ 2021-03-17 18:28 ttpfx 阅读(49) 评论(0) 推荐(0) 编辑
摘要: Maven导入Spring依赖 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>5.3.3</version> </dependency> Spr 阅读全文
posted @ 2021-03-17 12:26 ttpfx 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 简单CRUD package com.ttpfx.dao; import com.ttpfx.domain.User; import org.apache.ibatis.annotations.*; import java.util.List; public interface UserDao { 阅读全文
posted @ 2021-03-10 16:14 ttpfx 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 延迟加载 延迟加载是指关联对象的按需加载。把对多个表的一次连表查询,分解为对多个单表的多次查询。默认只查询主表的数据,在使用查询结果对象时,才去对关联表进行查询。 优点:提高数据库性能,单表查询效率高于连表查询 缺点:增加查询次数? 全局设置 <settings> <setting name="la 阅读全文
posted @ 2021-03-10 09:53 ttpfx 阅读(45) 评论(0) 推荐(0) 编辑
摘要: 一对一 一个账户对应一个用户: 账户实体: public class Account { private Integer id; private Double money; private User user; } 用户实体: public class User { private Integer 阅读全文
posted @ 2021-03-09 17:43 ttpfx 阅读(94) 评论(0) 推荐(0) 编辑
摘要: if 和 where public interface UserDao { List<User> getUserListByCondition(User user); } <select id="getUserListByCondition" parameterType="User" resultT 阅读全文
posted @ 2021-03-09 11:53 ttpfx 阅读(42) 评论(0) 推荐(0) 编辑