zoukankan      html  css  js  c++  java
  • 【Spring实战4】01---初接触

    学习线路图:

    1、Spring框架的核心知识

    2、Spring构建Web应用程序

    3、后端使用Spring

    4、Spring与其他应用和服务进行集成

    在学习前做了一些功课,其中都强调了Spring容器、依赖注入(或者说控制反转)和面向切面编程AOP,对于学习Spring来说这部分内容很重要。

    基础部分讲解了spring核心特性:依赖注入 和 面向切面编程

    依赖注入的最大收益---松耦合:

    第一章主要讲述了一些Spring在开发中的应用实例,Spring通过面向POJO编程、DI、切面和模板技术来简化java开发中的复杂性

    如:

    在Car类中run方法执行前后,为RUN方法增加before以及after方法描述

    <?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"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-xsd">
            <bean id="car" class="nh.spring.ioc.beans.Car">
                <property name="brand" value="Ca11"/>
                <property name="color" value="blue"/>
            </bean>
    
            <bean id="runCar" class="nh.spring.ioc.beans.RunCar">
                <constructor-arg value="#{T(System).out}"/>
            </bean>
    
            <aop:config>
                <aop:aspect ref="runCar">
                    <aop:pointcut id="show" expression="execution(* show())"/>
                    <aop:before method="carBeforeRun" pointcut-ref="show"/>
                    <aop:after method="carAfterRun" pointcut-ref="show"/>
                </aop:aspect>
            </aop:config>
    </beans>
  • 相关阅读:
    又到黄金季节,该跳槽吗?怎么跳?
    分布式事务 6 个技术方案
    15 个 MyBatis 技巧,赶紧收藏吧!
    你的工资被倒挂了吗
    终于知道 Java agent 怎么重写字节码了
    每天的工作,你腻了吗?
    10 分钟轻松学会 Jackson 反序列化自动适配子类
    SpringMVC异步处理的 5 种方式
    Linux Cron 定时任务
    人类简史、软件架构和中台
  • 原文地址:https://www.cnblogs.com/hylinux/p/6022216.html
Copyright © 2011-2022 走看看