Swoft designed its own container based on the PSR-11 specification and enhanced its functionality based on annotations.

A container is a huge factory for storing and managing the Bean lifecycle.

What is a Bean

A Bean Swoft is a generic term for an object instance of a class in.

In Swoft , the object that makes up the application trunk and Swoft is managed by the IOC container is called bean . beanIs a Swoft An object that is instantiated, assembled, and managed by an IOC container.

IOCA container can be seen as a Beans collection of relationships

  • beanIs an object, one or more unqualified
  • beanSwoftManaged by one of IOC the things called in
  • Our applications are made up of individual bean

BeanFactoryProvides an advanced configuration mechanism to manage any kind of bean.

The definition of a bean should be BeanDefinition described: when 配置文件 / 注解 is parsed, it is converted internally into an BeanDefinition object. The next operation is done on this object.

Which are beans?

Beans are not equal to ' @Bean ', although in most cases they refer to the same thing.

As follows, all class annotation tags of the class, put into the container can be called Bean objects.

Class annotations, such as:

  • @BeanMost commonly used bean annotations
  • @Listener
  • @Controller
  • @Command
  • @WsModule
  • @WsController
  • Wait a minute...