您当前的位置: 首页 >  spring

梁云亮

暂无认证

  • 2浏览

    0关注

    1211博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

第一章 Spring入门

梁云亮 发布时间:2022-04-25 11:03:40 ,浏览量:2

一、Spring框架概述

Spring框架的创始人,同时也是SpringSource的联合创始人。Spring是面向切面编程(AOP)和控制反转(IoC)的容器框架。Rod的畅销书Expert One-on-One J2EE Design and Development(2002年出版)是迄今为止J2EE领域最具影响力的书之一。

image-20210629112053366

1.1 spring概述

Spring框架是一个开放源代码的J2EE应用程序框架,由[Rod Johnson](https://baike.baidu.com/item/Rod Johnson/1423612)发起,是针对bean的生命周期进行管理的轻量级容器(lightweight container)。 Spring解决了开发者在J2EE开发中遇到的许多常见的问题,提供了功能强大IOC、AOP及Web MVC等功能。Spring可以单独应用于构筑应用程序,也可以和Struts、Webwork、Tapestry等众多Web框架组合使用,并且可以与 Swing等桌面应用程序AP组合。因此, Spring不仅仅能应用于J2EE应用程序之中,也可以应用于桌面应用程序以及小应用程序之中。Spring框架主要由七部分组成,分别是 Spring Core、 Spring AOP、 Spring ORM、 Spring DAO、Spring Context、 Spring Web和 Spring Web MVC。

img

img

img

1.2 框构特征

轻量——从大小与开销两方面而言Spring都是轻量的。完整的Spring框架可以在一个大小只有1MB多的JAR文件里发布。并且Spring所需的处理开销也是微不足道的。此外,Spring是非侵入式的:典型地,Spring应用中的对象不依赖于Spring的特定类。

控制反转——Spring通过一种称作控制反转(IoC)的技术促进了低耦合。当应用了IoC,一个对象依赖的其它对象会通过被动的方式传递进来,而不是这个对象自己创建或者查找依赖对象。你可以认为IoC与JNDI相反——不是对象从容器中查找依赖,而是容器在对象初始化时不等对象请求就主动将依赖传递给它。它的底层设计模式采用了工厂模式,所有的 Bean 都需要注册到Bean工厂中,将其初始化和生命周期的监控交由工厂实现管理。程序员只需要按照规定的格式进行Bean开发,然后利用XML文件进行bean 的定义和参数配置,其他的动态生成和监控就不需要调用者完成,而是统一交给了平台进行管理。 [4] 控制反转是软件设计大师 Martin Fowler在 2004 年发表的”Inversion of Control Containers and the Dependency Injection pattern”提出的。这篇文章系统阐述了控制反转的思想,提出了控制反转有依赖查找和依赖注入实现方式。控制反转意味着在系统开发过程中,设计的类将交由容器去控制,而不是在类的内部去控制,类与类之间的关系将交由容器处理,一个类在需要调用另一个类时,只要调用另一个类在容器中注册的名字就可以得到这个类的实例,与传统的编程方式有了很大的不同,“不用你找,我来提供给你”,这就是控制反转的含义 [5] 。

面向切面——Spring提供了面向切面编程的丰富支持,允许通过分离应用的业务逻辑与系统级服务(例如审计(auditing)和事务(transaction)管理)进行内聚性的开发。应用对象只实现它们应该做的——完成业务逻辑——仅此而已。它们并不负责(甚至是意识)其它的系统级关注点,例如日志或事务支持。

容器——Spring包含并管理应用对象的配置和生命周期,在这个意义上它是一种容器,你可以配置你的每个bean如何被创建——基于一个可配置原型(prototype),你的bean可以创建一个单独的实例或者每次需要时都生成一个新的实例——以及它们是如何相互关联的。然而,Spring不应该被混同于传统的重量级的EJB容器,它们经常是庞大与笨重的,难以使用。

框架——Spring可以将简单的组件配置、组合成为复杂的应用。在Spring中,应用对象被声明式地组合,典型地是在一个XML文件里。Spring也提供了很多基础功能(事务管理、持久化框架集成等等),将应用逻辑的开发留给了你。

MVC——Spring的作用是整合,但不仅仅限于整合,Spring 框架可以被看做是一个企业解决方案级别的框架。客户端发送请求,服务器控制器(由DispatcherServlet实现的)完成请求的转发,控制器调用一个用于映射的类HandlerMapping,该类用于将请求映射到对应的处理器来处理请求。HandlerMapping 将请求映射到对应的处理器Controller(相当于Action)在Spring 当中如果写一些处理器组件,一般实现Controller 接口,在Controller 中就可以调用一些Service 或DAO 来进行数据操作 ModelAndView 用于存放从DAO 中取出的数据,还可以存放响应视图的一些数据。 如果想将处理结果返回给用户,那么在Spring 框架中还提供一个视图组件ViewResolver,该组件根据Controller 返回的标示,找到对应的视图,将响应response 返回给用户。

所有Spring的这些特征使你能够编写更干净、更可管理、并且更易于测试的代码。它们也为Spring中的各种模块提供了基础支持。

1.3 框架特性

强大的基于 JavaBeans的采用控制反转(Inversion of Control,IoC)原则的配置管理,使得应用程序的组件更加快捷简易。一个可用于从 applet 到 Java EE 等不同运行环境的核心 Bean 工厂。

数据库事务的一般化抽象层,允许宣告式(Declarative)事务管理器,简化事务的划分使之与底层无关。

内建的针对 JTA 和 单个 JDBC 数据源的一般化策略,使 Spring 的事务支持不要求 Java EE 环境,这与一般的 JTA 或者 EJB CMT 相反。

JDBC 抽象层提供了有针对性的异常等级(不再从SQL异常中提取原始代码),简化了错误处理,大大减少了程序员的编码量。 再次利用JDBC时,你无需再写出另一个 ‘终止’ (finally) 模块。并且面向JDBC的异常与Spring 通用数据访问对象(Data Access Object) 异常等级相一致.

以资源容器,DAO 实现和事务策略等形式与 Hibernate,JDO 和 iBATIS SQL Maps 集成。利用众多的反转控制方便特性来全面支持, 解决了许多典型的Hibernate集成问题。所有这些全部遵从Spring通用事务处理和通用数据访问对象异常等级规范。

灵活的基于核心Spring 功能的 MVC网页应用程序框架。开发者通过策略接口将拥有对该框架的高度控制,因而该框架将适应于多种呈现(View)技术,例如 JSP,FreeMarker,Velocity,Tiles,iText 以及 POI。值得注意的是,Spring 中间层可以轻易地结合于任何基于 MVC 框架的网页层,例如 Struts,WebWork,或 Tapestry。

提供诸如事务管理等服务的面向切面编程(AOP)框架。

image-20210629112310361

1.4 Spring框架的7个模块

img

Spring 框架是一个分层架构,由 7 个定义良好的模块组成。Spring 模块构建在核心容器之上,核心容器定义了创建、配置和管理 bean 的方式,组成 Spring 框架的每个模块(或组件)都可以单独存在,或者与其他一个或多个模块联合实现。每个模块的功能如下:

  • 核心容器:核心容器提供 Spring 框架的基本功能。核心容器的主要组件是 BeanFactory,它是工厂模式的实现。BeanFactory 使用控制反转 (IOC)模式将应用程序的配置和依赖性规范与实际的应用程序代码分开。

  • Spring 上下文:Spring 上下文是一个配置文件,向 Spring 框架提供上下文信息。Spring 上下文包括企业服务,例如 JNDI、EJB、电子邮件、国际化、校验和调度功能。

  • Spring AOP:通过配置管理特性,Spring AOP 模块直接将面向方面的编程功能集成到了 Spring 框架中。所以,可以很容易地使 Spring 框架管理的任何对象支持 AOP。Spring AOP 模块为基于 Spring 的应用程序中的对象提供了事务管理服务。通过使用 Spring AOP,不用依赖 EJB 组件,就可以将声明性事务管理集成到应用程序中。

  • Spring DAO:JDBC DAO 抽象层提供了有意义的异常层次结构,可用该结构来管理异常处理和不同数据库供应商抛出的错误消息。异常层次结构简化了错误处理,并且极大地降低了需要编写的异常代码数量(例如打开和关闭连接)。Spring DAO 的面向 JDBC 的异常遵从通用的 DAO 异常层次结构。

  • Spring ORM:Spring 框架插入了若干个 ORM 框架,从而提供了 ORM 的对象关系工具,其中包括 JDO、Hibernate 和 iBatis SQL Map。所有这些都遵从 Spring 的通用事务和 DAO 异常层次结构。

  • Spring Web 模块:Web 上下文模块建立在应用程序上下文模块之上,为基于 Web 的应用程序提供了上下文。所以,Spring 框架支持与 Jakarta Struts 的集成。Web 模块还简化了处理多部分请求以及将请求参数绑定到域对象的工作。

  • Spring MVC 框架:MVC 框架是一个全功能的构建 Web 应用程序的 MVC 实现。通过策略接口,MVC 框架变成为高度可配置的,MVC 容纳了大量视图技术,其中包括 JSP、Velocity、Tiles、iText 和 POI。

Spring 框架的功能可以用在任何 J2EE 服务器中,大多数功能也适用于不受管理的环境。Spring 的核心要点是:支持不绑定到特定 J2EE 服务的可重用业务和数据访问对象。毫无疑问,这样的对象可以在不同 J2EE 环境 (Web 或 EJB)、独立应用程序、测试环境之间重用。

1.5 框架特点

1.方便解耦,简化开发

通过Spring提供的IoC容器,我们可以将对象之间的依赖关系交由Spring进行控制,避免硬编码所造成的过度程序耦合。有了Spring,用户不必再为单实例模式类、属性文件解析等这些很底层的需求编写代码,可以更专注于上层的应用。

2.AOP编程支持

通过Spring提供的AOP功能,方便进行面向切面的编程,许多不容易用传统OOP实现的功能可以通过AOP轻松应付。

3.声明式事务的支持

在Spring中,我们可以从单调烦闷的事务管理代码中解脱出来,通过声明式方式灵活地进行事务的管理,提高开发效率和质量。

4.方便程序的测试

可以用非容器依赖的编程方式进行几乎所有的测试工作,在Spring里,测试不再是昂贵的操作,而是随手可做的事情。例如:Spring对Junit4支持,可以通过注解方便的测试Spring程序。

5.方便集成各种优秀框架

Spring不排斥各种优秀的开源框架,相反,Spring可以降低各种框架的使用难度,Spring提供了对各种优秀框架(如Struts,Hibernate、Hessian、Quartz)等的直接支持。

6.降低Java EE API的使用难度

Spring对很多难用的Java EE API(如JDBC,JavaMail,远程调用等)提供了一个薄薄的封装层,通过Spring的简易封装,这些Java EE API的使用难度大为降低。

7.Java 源码是经典学习范例

Spring的源码设计精妙、结构清晰、匠心独运,处处体现着大师对 Java设计模式 灵活运用以及对Java技术的高深造诣。Spring框架源码无疑是Java技术的最佳实践范例。如果想在短时间内迅速提高自己的Java技术水平和应用开发水平,学习和研究Spring源码将会使你收到意想不到的效果。

总结起来,Spring有如下优点:

1.低侵入式设计,代码污染极低

2.独立于各种应用服务器,基于Spring框架的应用,可以真正实现Write Once,Run Anywhere的承诺

3.Spring的DI机制降低了业务对象替换的复杂性,提高了组件之间的解耦

4.Spring的AOP支持允许将一些通用任务如安全、事务、日志等进行集中式管理,从而提供了更好的复用

5.Spring的ORM和DAO提供了与第三方持久层框架的良好整合,并简化了底层的数据库访问

6.Spring并不强制应用完全依赖于Spring,开发者可自由选用Spring框架的部分或全部

1.6 spring框架相关的地址
  • 官方网址:spring.io

  • 官方下载网址:https://repo.spring.io/release/org/springframework/spring/

  • 官方github地址:https://github.com/spring-projects/spring-framework

  • 下载springframework地址 http://repo.spring.io/release/org/springframework/spring/

  • 官方文档 spring.io/guides/gs/serving-web-content/

    https://docs.spring.io/spring-framework/docs/current/spring-framework-reference

  • Spring 官方github地址 https://github.com/spring-projects

  • SpringMVC爱好者中文网站http://www.springmvc.cn/

image-20210629112229723

二、helloworld入门案例

spring框架开发最基本的maven依赖如下:


    org.springframework
    spring-context
    5.3.8

image-20210619201227960

2.1、传统xml配置文件方式
  1. 建立maven项目,pom.xml文件添加依赖

    
    
        4.0.0
        cn.webrx
        sp01
        1.0
        
            16
            16
        
        
            
                org.springframework
                spring-context
                5.3.8
            
            
                org.projectlombok
                lombok
                1.18.20
                provided
            
        
    
    
  2. 项目src/main/resources/applicationContext.xml建立核心配置文件

    
    
        
        
        
    
    
    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn.webrx.service;
    
    import org.springframework.stereotype.Service;
    
    /**
     * 

    Project: sp01 - UserDao *

    Powered by webrx On 2021-06-19 14:30:31 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @Service public class UserDao { }

  3. 编写相关的bean

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn.webrx.entity;
    
    import lombok.Data;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.stereotype.Component;
    
    /**
     * 

    Project: sp01 - User *

    Powered by webrx On 2021-06-19 14:30:16 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @Component @Data public class User { private Integer id; @Value("张三丰") private String name; }

  4. 编写主测试程序

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn.webrx;
    
    import cn.webrx.entity.User;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
    
    import java.util.Date;
    
    /**
     * 

    Project: sp01 - Demo *

    Powered by webrx On 2021-06-17 12:27:20 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ public class Demo { public static void main(String[] args) { var ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); var d = ctx.getBean("now", Date.class); System.out.println(d); User u = ctx.getBean("user",User.class); System.out.println(u.getName()); ctx.close(); } }

  5. 项目程序结构图及运行结果

    image-20210619200701473

2.2、可编程方式
  1. 建立maven项目,pom.xml添加依赖

    
    
        4.0.0
        cn.webrx
        sp01
        1.0
        
            16
            16
        
        
            
                org.springframework
                spring-context
                5.3.8
            
            
                org.springframework
                spring-webmvc
                5.3.8
            
            
                org.springframework
                spring-jdbc
                5.3.8
            
            
                org.springframework
                spring-test
                5.3.8
            
            
                org.projectlombok
                lombok
                1.18.20
                provided
            
        
    
    
  2. 编写bean,service,dao,pojo,entity相关的类

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn.webrx.entity;
    
    import lombok.Data;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.stereotype.Component;
    
    /**
     * 

    Project: sp01 - User *

    Powered by webrx On 2021-06-19 14:30:16 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @Component @Data public class User { private Integer id; @Value("张三丰") private String name; }

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn.webrx.service;
    
    import org.springframework.stereotype.Service;
    
    /**
     * 

    Project: sp01 - UserDao *

    Powered by webrx On 2021-06-19 14:30:31 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @Service public class UserDao { }

  3. 编写配置文件AppConfig.java或SpringConfig.java

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn.webrx;
    
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.ComponentScan;
    import org.springframework.context.annotation.Configuration;
    
    import java.util.Date;
    
    /**
     * 

    Project: sp01 - AppConfig *

    Powered by webrx On 2021-06-19 19:04:55 *

    这里如果有多个配置文件,也可以使用@Import() 引入 *

    @Configuration 注解会被Spring托管,注册到容器中,他代表这是一个配置类,相当于applicationContext.xml * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @Configuration @ComponentScan(basePackages = {"cn.webrx.entity", "cn.webrx.service"}) public class AppConfig { /** * 注册一个bean,相当于bean标签,一般方法名getDate为id名,这里直接@Bean("dd") 所以id名为dd * @return */ @Bean("dd") public Date getDate(){ System.out.println("自动实例化 java.util.Date类"); return new Date(); } }

  4. 编写主测试程序

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn.webrx;
    
    import cn.webrx.entity.User;
    import org.springframework.context.annotation.AnnotationConfigApplicationContext;
    
    import java.util.Date;
    
    /**
     * 

    Project: sp01 - AppTest *

    Powered by webrx On 2021-06-19 14:29:04 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ public class AppTest { public static void main(String[] args) { var ctx = new AnnotationConfigApplicationContext(AppConfig.class); var u = ctx.getBean(User.class); System.out.println(u.getName()); var d1 = ctx.getBean(Date.class); var d2 = ctx.getBean("dd", Date.class); System.out.println(d1); System.out.println(d2); //spring框架默认IoC容器是单例对象 System.out.println(d1 == d2); } }

    程序运行结果

    image-20210619203237069

    image-20210629110908313

三、Spring 单元测试案例

    org.springframework
    spring-test
    5.3.8



    junit
    junit
    4.13.2
    test

  1. maven项目pom.xml添加依赖

    
    
        4.0.0
        cn.webrx
        sp01
        1.0
        
            16
            16
        
        
            
                org.springframework
                spring-context
                5.3.8
            
    
            
                org.springframework
                spring-test
                5.3.8
            
            
                org.projectlombok
                lombok
                1.18.20
                provided
            
            
            
                junit
                junit
                4.13.2
                test
            
    
        
    
    
  2. 编写bean

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn.webrx.entity;
    
    import lombok.Data;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.stereotype.Component;
    
    /**
     * 

    Project: sp01 - User *

    Powered by webrx On 2021-06-19 14:30:16 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @Component @Data public class User { private Integer id; @Value("张三丰") private String name; }

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn.webrx.service;
    
    import org.springframework.stereotype.Service;
    
    /**
     * 

    Project: sp01 - UserDao *

    Powered by webrx On 2021-06-19 14:30:31 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @Service public class UserDao { }

  3. 编写配置

    
    
        
        
        
    
    
    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn.webrx;
    
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.ComponentScan;
    import org.springframework.context.annotation.Configuration;
    
    import java.util.Date;
    
    /**
     * 

    Project: sp01 - AppConfig *

    Powered by webrx On 2021-06-19 19:04:55 *

    这里如果有多个配置文件,也可以使用@Import() 引入 *

    @Configuration 注解会被Spring托管,注册到容器中,他代表这是一个配置类,相当于applicationContext.xml * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @Configuration @ComponentScan(basePackages = {"cn.webrx.entity", "cn.webrx.service"}) public class AppConfig { /** * 注册一个bean,相当于bean标签,一般方法名getDate为id名,这里直接@Bean("dd") 所以id名为dd * @return */ @Bean("dd") public Date getDate(){ System.out.println("自动实例化 java.util.Date类"); return new Date(); } }

  4. 单元测试程序

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn;
    
    import cn.webrx.AppConfig;
    import cn.webrx.entity.User;
    import cn.webrx.service.UserDao;
    import org.junit.Test;
    import org.junit.runner.RunWith;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.test.context.ContextConfiguration;
    import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
    
    /**
     * 

    Project: sp01 - SpringTest *

    Powered by webrx On 2021-06-19 21:27:29 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @RunWith(SpringJUnit4ClassRunner.class) //单元测试,加载xml配置文件方式 //@ContextConfiguration({"classpath:applicationContext.xml"}) //单元测试,加载配置程序类 @ContextConfiguration(classes = {AppConfig.class}) public class SpringTest { @Autowired private User user; @Autowired private UserDao udao; @Test public void m1() { System.out.println(user); System.out.println(user.getName()); System.out.println(udao); } }

    简单实例

    image-20210629105746453

    image-20210629105727585

    image-20210629105805573

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn;
    
    import cn.webrx.config.AppConfig;
    import cn.webrx.entity.User;
    import cn.webrx.service.BookDAO;
    import cn.webrx.service.UserDAO;
    import org.junit.Test;
    import org.junit.runner.RunWith;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.test.context.ContextConfiguration;
    import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
    
    import java.util.Date;
    
    /**
     * 

    Project: spring - Demo *

    Powered by webrx On 2021-07-01 09:19:03 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {AppConfig.class}) public class Demo { @Autowired private User u; @Autowired private UserDAO udao; @Autowired private BookDAO bdao; @Autowired private Date dd; @Test public void t1(){ System.out.println(u); } @Test public void t2(){ System.out.println(udao); } @Test public void t3(){ bdao.show(); } @Test public void t4(){ System.out.println(dd); } }

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn;
    
    import cn.webrx.entity.User;
    import cn.webrx.service.BookDAO;
    import cn.webrx.service.UserDAO;
    import org.junit.Test;
    import org.junit.runner.RunWith;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.test.context.ContextConfiguration;
    import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
    
    import java.util.Date;
    
    /**
     * 

    Project: spring - Demo *

    Powered by webrx On 2021-07-01 09:19:03 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:beans.xml"}) public class MyDemo { @Autowired private User u; @Autowired private UserDAO udao; @Autowired private BookDAO bdao; @Autowired private Date date; @Test public void t1() { System.out.println(u); } @Test public void t2() { System.out.println(udao); } @Test public void t3() { bdao.show(); } @Test public void t4() { System.out.println(date); } }

    /*
     * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
     *
     */
    package cn.webrx.config;
    
    import org.springframework.context.annotation.ComponentScan;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.context.annotation.Import;
    
    /**
     * 

    Project: spring - AppConfig *

    Powered by webrx On 2021-07-01 09:16:13 *

    Created by IntelliJ IDEA * * @author webrx [webrx@126.com] * @version 1.0 * @since 16 */ @Configuration @ComponentScan(basePackages = {"cn.webrx.entity"}) @Import({DateConfig.class, DateConfig.class}) public class AppConfig { }

关注
打赏
1665409997
查看更多评论
立即登录/注册

微信扫码登录

0.0484s