Giter VIP home page Giter VIP logo

spring-learn's Introduction

spring-learn

Build Status codecov

介绍

spring底层学习demo

1.Spring IOC容器

1. Spring注入方式

  1. set方法注入
  2. 构造方法注入

2.Bean的装配

1. Bean的作用域

  1. singleton 单例获取
  2. prototype 每次请求都创建实例

2. Bean的生命周期

  1. 定义、初始化、使用、销毁
  2. 待补充...

3. Spring aware - 让bean获取spring容器的服务

  1. BeanNameAware 可以获取容器中bean的名称
  2. ApplicationContextAware 当前的applicationContext, 这也可以调用容器的服务

4. Bean的自动装配

  1. byName 根据属性名称自动装配-set注入
  2. byType 在容器中查找指定属性类型进行装配-set注入
  3. constructor 与byType类似-构造方法注入

5. Bean的注解

  1. @Autowired 可以注解list和map;
  2. @Order(1) 改变注解顺序,list中有效
  3. @Qualifier("beanServiceImplOne") 一个接口有多个实现,指定其中一个

6. try catch return

  1. 只要有finally,无论try中是否有return,finally中的代码都会被执行! 并且会在return之前被执行

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.