zoukankan      html  css  js  c++  java
  • AOP

    Spring是什么?Spring是一个库,提供一个软件框架  目的:使软件之间的逻辑更加清晰,配置更加灵活  。Spring的手段就是AOP和IOC

    其中AOP在Java中是利用反射机制实现 (动态代理也是用反射机制实现的)

    AOP的本质:在一系纵向的控制流中把那些相同的子流程提取成一个横向的面叫aspect面

    以下是Aop.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
            http://www.springframework.org/schema/aop
            http://www.springframework.org/schema/aop/spring-aop-4.2.xsd">
           
            <bean id="helloWorldImpl1" class="com.xrq.aop.HelloWorldImpl1" />
            <bean id="helloWorldImpl2" class="com.xrq.aop.HelloWorldImpl2" />
            <bean id="timeHandler" class="com.xrq.aop.TimeHandler" />
           
            <aop:config>
                <aop:aspect id="time" ref="timeHandler">
                    <aop:pointcut id="addAllMethod" expression="execution(* com.xrq.aop.HelloWorld.*(..))" />
                    <aop:before method="printTime" pointcut-ref="addAllMethod" />
                    <aop:after method="printTime" pointcut-ref="addAllMethod" />
                </aop:aspect>
            </aop:config>
    </beans>

    总结很重要哦 方法得当,坚持会有奇迹哦
  • 相关阅读:
    hexo博客搭建
    HDFS基本命令
    hadoop简单排序
    HBase实验
    linux版python升级依赖项问题
    hadoop大数据生态安装
    linux-anoconda更换镜像
    [渣译文] 使用 MVC 5 的 EF6 Code First 入门 系列:排序、筛选和分页
    [渣译文] 使用 MVC 5 的 EF6 Code First 入门 系列:实现基本的CRUD功能
    [渣译文] 使用 MVC 5 的 EF6 Code First 入门 系列:建立一个EF数据模型
  • 原文地址:https://www.cnblogs.com/sunyuhuan/p/8384231.html
Copyright © 2011-2022 走看看