Two methods of SpringIOC dependency injection (method of User class assignment)

Insert picture description here
Insert picture description here
One-to-one reference to ref in ApplicationContext.xml in Bean:
Insert picture description here
Insert picture description here
List and Properties, Map, Set injection

  1. Create the Order class
  2. injection
    Insert picture description here

Insert picture description here
Insert picture description here

Component scanning (context:compnent-scan base-pakage) @Repository (persistence layer annotation), @Service (service layer annotation), @Controller (control layer annotation) (equivalent to Component)

Insert picture description here
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/houzhicongone/article/details/114767612