zoukankan      html  css  js  c++  java
  • spring5.02版快速入门

    spring5.02版快速入门分为以下 四步,

    1. 引入依赖

    2. 创建beans.xml配置文件

    3 创建相应的接口实现类(仅仅是快速创建,实现类不给任何方法)

    4. 创建容器对象,根据id获取对象

    详细步骤如下:

    1. 引入依赖
    <!--引入spring 的最核心依赖-->
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>5.0.2.RELEASE</version>
    </dependency>
    2. 创建beans.xml配置文件

    <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
    http://www.springframework.org/schema/beans/spring-beans.xsd">

    </beans>

    3 创建相应的接口实现类(仅仅是快速创建,实现类不给任何方法)

    4. 创建容器对象,根据id获取对象
    ApplicationContext ac = new ClassPathXmlApplicationContext("beans.xml");
    Object userDao = ac.getBean("userDao");
    System.out.println(userDao);
    ```

  • 相关阅读:
    多线程
    带缓存的输入输出流
    输入输出流I/O2
    输入输出流I/O
    课堂所讲整理:包装&工具类
    课堂所讲整理:Set和Map
    Java泛型和链表
    Java继承_接口练习题
    P235 实战练习(集合类)
    P188 实战练习(父类和子类)
  • 原文地址:https://www.cnblogs.com/lijun6/p/11117902.html
Copyright © 2011-2022 走看看