- id and name
- In general, when assembling a Bean, an id attribute specified by the name of Bean
- id attribute must be unique within the vessel IOC
- If the name Bean contains special characters, you need to use the name attribute
- class
- class is used to set a full path name of the class, the main role is an example of class generating IOC container
bean scope (scope attribute)
category | Explanation |
singleton | Bean instance only in the presence of a container SpringIOC, by way of a single example Bean presence |
prototype | Returns a new instance every time getBean call () |
request | Each HTTP request will create a new Bean, that scope applies only to the environment WebApplicationContext |
session | The same HTTP session share a Bean, different HTTP session using different Bean. The scope applies only to the environment WebApplicationContext |