SpringBoot
  • Introduction
  • springboot日志
    • logstash-json日志
  • springboot数据库
    • 初始化数据库
  • MongoDB使用
    • SpringBoot整合MongoDB(1)
    • SpringBoot整合MongoDB(2)
    • SpringBoot整合MongoDB(3)
    • SpringBoot整合MongoDB(4)
  • prometheus监控
    • springboot整合prometheus(一)
    • springboot整合prometheus(二)
    • springboot整合prometheus(三)
    • springboot整合prometheus(四)
    • springboot整合prometheus(五)
  • spring IOC
    • 注解IOC
  • 过滤器和拦截器
    • 过滤器
    • 拦截器
  • mybatis
    • springboot快速整合mybatis
  • 使用缓存
    • redis-cache
  • 异步线程池
    • 快速开始
    • 线程池
  • AOP切面
    • 快速开始
  • 限流
    • 使用Sentinel实现接口限流
      • 使用Sentinel实现接口限流
  • MybatisPlus
    • 快速开始
    • 基本使用
    • 查询方法
    • 主键策略和基本配置
Powered by GitBook
On this page

Was this helpful?

  1. spring IOC

注解IOC

  • @Component:组件:

    有三个衍生注解:

    • @Controller :描述Web层的类

    • @Service :描述业务层的类

    • @Repository :描述持久层的类

  • @Value:注入普通类型属性(字符串和基本数据类型)

  • @Autowired:自动装配(此注解是按照类型自动装配的),如果需要指定名称,加@Qualifier( "" )

    • @Resource注解:相当于: @Autowired + @Qulifer(value=””)

  • @Scope(value="prototype"):Spring生成类的过程中多例的模式,指定bean的作用范围

  • @PostConstruct:相当于init-method,Bean初始化的时候执行的方法

  • @PreDestroy:相当于destroy-method,Bean销毁的时候执行的方法(1. 对象必须是单例创建的才可以销毁.2. 必须等到工厂关闭的时候才会销毁对象.)

Previousspring IOCNext过滤器和拦截器

Last updated 6 years ago

Was this helpful?