上一页 1 2 3 4 5 6 7 8 9 ··· 11 下一页
摘要: 1:添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</o 阅读全文
posted @ 2020-04-15 10:39 Draymond 阅读(572) 评论(0) 推荐(0) 编辑
摘要: 推荐版本 spring cloud Hocton.SR1 spring boot 2.2.2RELEASE cloud alibaba 2.1.0RELEASE java java8 maven 3.5以上 mysql 5.7以上 停更与替换 服务注册中心 eureka -> zookeeper / 阅读全文
posted @ 2020-04-14 20:23 Draymond 阅读(446) 评论(0) 推荐(0) 编辑
摘要: 需求:查询订单要返回用户名 为了解耦,查询订单中不查询用户,使用aop自动注入用户名 注意:订单列表中的用户缓存到了内存,遍历查询很快,如果直接查数据库,则效率相对低 思路:对返回值加强(aop对返回值增强,向订单表中注入userName) 1.注解 /** * 设置属性非空的开关 * 只有方法上加 阅读全文
posted @ 2020-04-09 22:50 Draymond 阅读(5088) 评论(0) 推荐(1) 编辑
摘要: 重要方法 /*获取参数的值数组*/ Object[] args = point.getArgs(); // [1] 参数的值 /*获取目标对象(被加强的对象)*/ Object target = point.getTarget(); /*获取signature 该注解作用在方法上,强转为 Metho 阅读全文
posted @ 2020-04-09 22:28 Draymond 阅读(5002) 评论(0) 推荐(2) 编辑
摘要: 作用:增强方法 本例基于 反射+注解+aspect 流程 1:创建注解(标识哪个方法使用aop,也可以直接使用表达式) 2:创建切面 3:创建方法,使用注解标记 1:创建注解 /** * 标记**方法使用 WebAspect 切面 */ @Retention(RetentionPolicy.RUNT 阅读全文
posted @ 2020-04-09 09:31 Draymond 阅读(194) 评论(0) 推荐(0) 编辑
摘要: @Component public class SpringContext implements ApplicationContextAware { // Spring应用上下文环境 private static ApplicationContext applicationContext; /** 阅读全文
posted @ 2020-04-08 10:16 Draymond 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 作用: spring所有Bean生成之后,加载一些数据和执行一些应用的初始化 使用 @Order(value = 1) // 多个实现时定义执行顺序 @Component public class ApplicationInit implements CommandLineRunner, Appli 阅读全文
posted @ 2020-04-08 09:54 Draymond 阅读(1028) 评论(0) 推荐(0) 编辑
摘要: SET GLOBAL log_bin_trust_function_creators = 1; DELIMITER $$ CREATE FUNCTION pro_salary_grade( salary INT) RETURNS CHAR BEGIN DECLARE grade CHAR DEFAU 阅读全文
posted @ 2020-04-06 13:59 Draymond 阅读(13172) 评论(0) 推荐(0) 编辑
摘要: DELIMITER $$ CREATE PROCEDURE pro_insert(IN maxNum INT) BEGIN DECLARE i INT DEFAULT(1); while i<=maxNum DO INSERT INTO employees (first_name ,last_nam 阅读全文
posted @ 2020-04-06 13:06 Draymond 阅读(3252) 评论(0) 推荐(0) 编辑
摘要: # 无参存储过程 DELIMITER $$ CREATE PROCEDURE pro_insert_employees() BEGIN insert into employees (first_name,last_name) VALUES("1","1"),("2","2"),("3","3"); 阅读全文
posted @ 2020-04-06 12:18 Draymond 阅读(186) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 11 下一页