Spring bean assembly and bean definition







Spring can detect all classes and register the corresponding beans in the IOC container,

For example, which can be automatically detected by spring. @serviec

There are also some methods such as. @autowird



auto scan




where the value in @service("mymovieListener") is relative to the id in the bean

If you don't write the value inside, for example @Repository will also automatically generate an id. The default is id to lowercase the first letter of the class




The default scope is singleton, an ioc container has only one




@Required annotation applies to setter methods of bean properties

This annotation simply means that the affected bean properties must be populated at configuration time, either through the bean definition or

Autowire an explicit property value



@AutoWired Autowiring



















Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326874355&siteId=291194637