- 博客(20)
- 问答 (1)
- 收藏
- 关注
原创 AOP 通知
顾问(Advisor)是 Spring 提供的另一种切面。其可以完成更为复杂的切面织入功能。PointcutAdvisor 是顾问的一种,可以指定具体的切入点。顾问将通知进行了包装,会根据不同的通知类型,在不同的时间点,将切面织入到不同的切入点。 PointcutAdvisor 接口有两个较为常用的实现类: NameMatchMethodPointcutAdvisor 名称匹配方法切入点顾问
2018-01-19 10:54:06 451
原创 AOP 有接口使用cglib
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans
2018-01-18 11:48:55 459
原创 AOP 无接口使用cglib
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans
2018-01-18 11:00:52 437
原创 AOP 为目标方法织入多个通知
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans
2018-01-18 10:40:12 491
原创 AOP 捕获自定义异常
package com.gqc.aop05;import org.springframework.aop.ThrowsAdvice;//异常通知public class MyThrowsAdvice implements ThrowsAdvice { // 当目标方法抛出UsernameException异常时,执行当前方法 public void afterThrowing(Use
2018-01-17 16:21:35 1836
原创 AOP 异常通知
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans
2018-01-17 10:49:54 536
原创 AOP 环绕通知
package com.gqc.aop03;import org.aopalliance.intercept.MethodInterceptor;import org.aopalliance.intercept.MethodInvocation;//环绕通知可以修改目标方法的返回结果public class MyMethodInterceptor implements MethodIn
2018-01-16 13:08:29 882
原创 AOP后置通知
package com.gqc.aop02;<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.
2018-01-16 11:25:34 608
原创 AOP前置通知
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans
2018-01-12 20:20:18 373
原创 AOP面向切面编程
aop 是面向对象编程oop的补充 面向对象编程是从静态的角度考虑程序的结构 面向切面编程是从动态的角度考虑程序运行的过程aop底层 是采用动态代理模式实现的 采用了两种代理 jdk的动态代理和 cglib的动态代理1、切面(aspect):对主业务进行增强的代码就是切面 常用的有通知advice和顾问advistor2、织入(weaving):将切面代码插入到目标对象的过程
2018-01-12 20:18:11 309
原创 为应用指定多个配置文件
包含关系<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans
2018-01-08 15:11:20 355
转载 classpath、path、JAVA_HOME的作用及JAVA环境变量配置
CLASSPATH是什么?它的作用是什么?它是javac编译器的一个环境变量。它的作用与import、package关键字有关。当你写下improt java.util.*时,编译器面对import关键字时,就知道你要引入java.util这个package中的类;但是编译器如何知道你把这个package放在哪里了呢?所以你首先得告诉编译器这个package的所在位置;如何告诉它呢?就是设
2018-01-08 14:59:44 369
原创 同类抽象Bean 异类抽象Bean
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans
2018-01-07 17:48:33 427
原创 内部Bean
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans
2018-01-07 16:10:41 402
原创 基于xml的di spel注入
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans
2018-01-07 15:44:53 330
原创 基于xml的注入di byName和byType
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans
2018-01-07 14:51:18 351
原创 基于XML的di(注入)
有三种 1 设值注入 2 构造注入 3 实现特定接口注入(因为要实现特定接口 是侵入式编程 污染代码 基本不用)设值注入:通过setter方法注入 value 基本数据类型和字符串 ref 传引用<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/200
2018-01-07 10:27:06 345
原创 Bean的整个生命周期
Step1:执行无参构造Step2执行setterStep2执行setterStep3:获取到bean的id:myServiceStep4:获取到beanFactory容器 Step5:执行---before---()方法Step6:Bean初始化完毕了Step7:初始化完毕之后Step8:执行---after---()方法ִStep9:执行doSome()
2018-01-06 16:36:25 2059
原创 Bean生命周期的始末
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans
2018-01-05 19:38:11 306
原创 Bean后处理器
Bean后处理器是一种特殊的Bean 没有id 容器中所有的Bean初始化的时候均会自动指定该类的两个方法 其他Bean在初始化之前 调用一个 初始化之后调用一个
2018-01-05 16:51:33 290
空空如也
IDEA 文件夹图标的问题
2018-05-10
TA创建的收藏夹 TA关注的收藏夹
TA关注的人