SlideShare a Scribd company logo
1 of 31
[object Object],[object Object]
 
[object Object],[object Object]
Class can be constructed in different ways  ,[object Object]
Using a constructor that takes an  int  argument which indicates the number of beanbags that the  Juggler will attempt to keep in the air
factory-created beans through the  <bean>  element’s  factory-method  attribute.
[object Object]
[object Object],Constructor Default <bean id=&quot;duke&quot; class=&quot;com.springinaction.springidol.Juggler&quot; /> Juggler juggler = new Juggler();  Constructor with primitive type <bean id=&quot;duke&quot; class=&quot;com.springinaction.springidol.Juggler&quot;>  <constructor-arg value=&quot;15&quot; /> </bean>  Juggler juggler = new Juggler(15);  Constructor with primitive type and an referecence to another bean. <bean id=&quot;sonnet29&quot; class=&quot;com.springinaction.springidol.Sonnet29&quot; />  <bean id=&quot;poeticDuke&quot; class=&quot;com.springinaction.springidol.PoeticJuggler&quot;>  <constructor-arg value=&quot;15&quot; />  <constructor-arg ref=&quot;sonnet29&quot; />  </bean>  Poem sonnet29 = new Sonnet29();  Performer duke = new PoeticJuggler(15, sonnet29);  Constructor with factory - method <bean id=&quot;theStage&quot; class=&quot;com.springinaction.springidol.Stage&quot;  factory-method=&quot;getInstance&quot; / >  public static Stage getInstance() { return StageSingletonHolder.instance; }
[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object]
Differents types of wiring: ,[object Object],[object Object],[object Object],[object Object]
don’t have an  id  attribute set.  not necessary because  you’ll never refer to the inner bean by name
they can’t be reused . They're  only useful for injection once  and  can’t be referred to by other beans ,[object Object],[object Object]
[object Object],Simple Properties: <bean id=&quot;kenny&quot; class=&quot;com.springinaction.springidol.Instrumentalist&quot;> <property name=&quot;song&quot; value=&quot;Jingle Bells&quot; /> <property name=&quot;age&quot; value=&quot;37&quot; /> </bean>  Referring other beans: <bean id=&quot;saxophone&quot; class=&quot;com.springinaction.springidol.Saxophone&quot; />  <bean id=&quot;kenny2&quot; class=&quot;com.springinaction.springidol.Instrumentalist&quot;>  <property name=&quot;song&quot; value=&quot;Jingle Bells&quot; />  <property name=&quot;instrument&quot; ref=&quot;saxophone&quot; />  </bean>  Inner Beans <bean id=&quot;kenny&quot; class=&quot;com.springinaction.springidol.Instrumentalist&quot;>  <property name=&quot;song&quot; value=&quot;Jingle Bells&quot; /> <property name=&quot;instrument&quot;>  <bean class=&quot;org.springinaction.springidol.Saxophone&quot; />  </property>  </bean>  <bean id=&quot;duke&quot; class=&quot;com.springinaction.springidol.PoeticJuggler&quot;>  <constructor-arg value=&quot;15&quot; /> <constructor-arg>  <bean class=&quot;com.springinaction.springidol.Sonnet29&quot; />  </constructor-arg>  </bean>
[object Object],Simple Properties: <bean id=&quot;kenny&quot; class=&quot;com.springinaction.springidol.Instrumentalist&quot;> <property name=&quot;song&quot; value=&quot;Jingle Bells&quot; /> <property name=&quot;age&quot; value=&quot;37&quot; /> </bean>  Referring other beans: <bean id=&quot;saxophone&quot; class=&quot;com.springinaction.springidol.Saxophone&quot; />  <bean id=&quot;kenny2&quot; class=&quot;com.springinaction.springidol.Instrumentalist&quot;>  <property name=&quot;song&quot; value=&quot;Jingle Bells&quot; />  <property name=&quot;instrument&quot; ref=&quot;saxophone&quot; />  </bean>  Inner Beans <bean id=&quot;kenny&quot; class=&quot;com.springinaction.springidol.Instrumentalist&quot;>  <property name=&quot;song&quot; value=&quot;Jingle Bells&quot; /> <property name=&quot;instrument&quot;>  <bean class=&quot;org.springinaction.springidol.Saxophone&quot; />  </property>  </bean>  <bean id=&quot;duke&quot; class=&quot;com.springinaction.springidol.PoeticJuggler&quot;>  <constructor-arg value=&quot;15&quot; /> <constructor-arg>  <bean class=&quot;com.springinaction.springidol.Sonnet29&quot; />  </constructor-arg>  </bean>
[object Object],[object Object]
polirmorfismo  ,[object Object]
[object Object],Simple Properties: <bean id=&quot;kenny&quot; class=&quot;com.springinaction.springidol.Instrumentalist&quot;> <property name=&quot;song&quot; value=&quot;Jingle Bells&quot; /> <property name=&quot;age&quot; value=&quot;37&quot; /> </bean>  Referring other beans: <bean id=&quot;saxophone&quot; class=&quot;com.springinaction.springidol.Saxophone&quot; />  <bean id=&quot;kenny2&quot; class=&quot;com.springinaction.springidol.Instrumentalist&quot;>  <property name=&quot;song&quot; value=&quot;Jingle Bells&quot; />  <property name=&quot;instrument&quot; ref=&quot;saxophone&quot; />  </bean>  Inner Beans <bean id=&quot;kenny&quot; class=&quot;com.springinaction.springidol.Instrumentalist&quot;>  <property name=&quot;song&quot; value=&quot;Jingle Bells&quot; /> <property name=&quot;instrument&quot;>  <bean class=&quot;org.springinaction.springidol.Saxophone&quot; />  </property>  </bean>  <bean id=&quot;duke&quot; class=&quot;com.springinaction.springidol.PoeticJuggler&quot;>  <constructor-arg value=&quot;15&quot; /> <constructor-arg>  <bean class=&quot;com.springinaction.springidol.Sonnet29&quot; />  </constructor-arg>  </bean>
[object Object],[object Object]
Set
Map
Properties
[object Object],[object Object]
A <list> may contain another <list> as a member for multidi-mensional lists.
Either <list> or <set> can be used to wire any implementation of java.util.Collection or an array
[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
<props>   is the element used to define a collection value of type  java.util .Properties .
<prop>   is the element used to define a member of a  <props>  collection
SpEL Overview ,[object Object]

More Related Content

Viewers also liked

Design Pattern - 3. Decorator pattern
Design Pattern - 3. Decorator patternDesign Pattern - 3. Decorator pattern
Design Pattern - 3. Decorator patternFrancesco Ierna
 
Design Pattern 5. Singleton Pattern
Design Pattern 5. Singleton PatternDesign Pattern 5. Singleton Pattern
Design Pattern 5. Singleton PatternFrancesco Ierna
 
SCBCD 2. differenze stateless stateful
SCBCD 2. differenze stateless   statefulSCBCD 2. differenze stateless   stateful
SCBCD 2. differenze stateless statefulFrancesco Ierna
 
Design Pattern 4. Factory Pattern
Design Pattern 4. Factory PatternDesign Pattern 4. Factory Pattern
Design Pattern 4. Factory PatternFrancesco Ierna
 

Viewers also liked (9)

Design Pattern - 3. Decorator pattern
Design Pattern - 3. Decorator patternDesign Pattern - 3. Decorator pattern
Design Pattern - 3. Decorator pattern
 
Design Pattern 5. Singleton Pattern
Design Pattern 5. Singleton PatternDesign Pattern 5. Singleton Pattern
Design Pattern 5. Singleton Pattern
 
SCDJWS 6. REST JAX-P
SCDJWS 6. REST  JAX-PSCDJWS 6. REST  JAX-P
SCDJWS 6. REST JAX-P
 
SCDJWS 1. xml schema
SCDJWS 1. xml schemaSCDJWS 1. xml schema
SCDJWS 1. xml schema
 
SCBCD 2. differenze stateless stateful
SCBCD 2. differenze stateless   statefulSCBCD 2. differenze stateless   stateful
SCBCD 2. differenze stateless stateful
 
SCDJWS 2. Soap
SCDJWS 2. SoapSCDJWS 2. Soap
SCDJWS 2. Soap
 
SCDJWS 3. WSDL
SCDJWS 3. WSDLSCDJWS 3. WSDL
SCDJWS 3. WSDL
 
Design Pattern 4. Factory Pattern
Design Pattern 4. Factory PatternDesign Pattern 4. Factory Pattern
Design Pattern 4. Factory Pattern
 
SCBCD 1. generic ejb
SCBCD 1. generic ejbSCBCD 1. generic ejb
SCBCD 1. generic ejb
 

Similar to 2. wiring beans

Hibernate Session 2
Hibernate Session 2Hibernate Session 2
Hibernate Session 2b_kathir
 
JSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph PicklJSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph PicklChristoph Pickl
 
Krazykoder struts2 data_tags
Krazykoder struts2 data_tagsKrazykoder struts2 data_tags
Krazykoder struts2 data_tagsKrazy Koder
 
Struts Tags Speakernoted
Struts Tags SpeakernotedStruts Tags Speakernoted
Struts Tags SpeakernotedHarjinder Singh
 
Beautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesBeautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesLincoln III
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To HibernateAmit Himani
 
Beginning Object-Oriented JavaScript
Beginning Object-Oriented JavaScriptBeginning Object-Oriented JavaScript
Beginning Object-Oriented JavaScriptStoyan Stefanov
 
Evolution of API With Blogging
Evolution of API With BloggingEvolution of API With Blogging
Evolution of API With BloggingTakatsugu Shigeta
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat ToolKanika2885
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat ToolKanika2885
 

Similar to 2. wiring beans (20)

Spring 2.0
Spring 2.0Spring 2.0
Spring 2.0
 
Spring 2.0
Spring 2.0Spring 2.0
Spring 2.0
 
Sping Slide 6
Sping Slide 6Sping Slide 6
Sping Slide 6
 
Hibernate Session 2
Hibernate Session 2Hibernate Session 2
Hibernate Session 2
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
JSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph PicklJSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph Pickl
 
JSP Custom Tags
JSP Custom TagsJSP Custom Tags
JSP Custom Tags
 
Ant
Ant Ant
Ant
 
Using Forms in Share
Using Forms in ShareUsing Forms in Share
Using Forms in Share
 
Krazykoder struts2 data_tags
Krazykoder struts2 data_tagsKrazykoder struts2 data_tags
Krazykoder struts2 data_tags
 
displaytag
displaytagdisplaytag
displaytag
 
Seam Glassfish Slidecast
Seam Glassfish SlidecastSeam Glassfish Slidecast
Seam Glassfish Slidecast
 
Struts Tags Speakernoted
Struts Tags SpeakernotedStruts Tags Speakernoted
Struts Tags Speakernoted
 
Beautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesBeautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFaces
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To Hibernate
 
Spring overview
Spring overviewSpring overview
Spring overview
 
Beginning Object-Oriented JavaScript
Beginning Object-Oriented JavaScriptBeginning Object-Oriented JavaScript
Beginning Object-Oriented JavaScript
 
Evolution of API With Blogging
Evolution of API With BloggingEvolution of API With Blogging
Evolution of API With Blogging
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat Tool
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat Tool
 

Recently uploaded

A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Recently uploaded (20)

A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

2. wiring beans

  • 1.
  • 2.  
  • 3.
  • 4.
  • 5. Using a constructor that takes an int argument which indicates the number of beanbags that the Juggler will attempt to keep in the air
  • 6. factory-created beans through the <bean> element’s factory-method attribute.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. don’t have an id attribute set. not necessary because you’ll never refer to the inner bean by name
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. Set
  • 22. Map
  • 24.
  • 25. A <list> may contain another <list> as a member for multidi-mensional lists.
  • 26. Either <list> or <set> can be used to wire any implementation of java.util.Collection or an array
  • 27.
  • 28.
  • 29. <props> is the element used to define a collection value of type java.util .Properties .
  • 30. <prop> is the element used to define a member of a <props> collection
  • 31.
  • 32. #{} markers  : We could wire this value into a bean’s property by using #{} markers in a <property> element’s value
  • 33.
  • 35.
  • 36.
  • 37.
  • 38. byType —Attempts to match all properties of the autowired bean with beans whose types are assignable to the properties. Properties for which there’s no matching bean will remain unwired.
  • 39. constructor —Tries to match up a constructor of the autowired bean with beans whose types are assignable to the constructor arguments
  • 40. autodetect —Attempts to apply constructor autowiring first. If that fails, byType will be tried
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48. @Controller : Indicates that the class defines a Spring MVC controller
  • 49. @Repository : Indicates that the class defines a data repository
  • 50.
  • 51.
  • 53. <!-- bean declarations go here --> </beans> <bean id=&quot;kenny2&quot; class=&quot;com.springinaction.springidol.Instrumentalist&quot;> …. <property name=&quot;instrument&quot; ref=&quot;saxophone&quot; /> </bean> Autowiring byType: @Autowired public void setInstrument(Instrument instrument) { this.instrument = instrument; } Autowiring byType not in a setter method: @Autowired public void heresYourInstrument(Instrument instrument) { this.instrument = instrument; } Autowiring byConstructor: @Autowired public Instrumentalist(Instrument instrument) { this.instrument = instrument; } Autowiring in a private field: @Autowired private Instrument instrument. @Qualifier annotation will try to wire in a bean whose ID matches guitar. @Autowired @Qualifier(&quot;guitar&quot;) private Instrument instrument
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.