Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
Spring inner bean instantiation

first of all please refer to this tutorial i've been reading.

Spring Injecting Inner Bean

I've been following that tutorial because it seems much easier to understand than other tutorials and guides over the internet.

So i am having trouble grasping the concept of inner bean here. It was not explicitly indicated on that tutorial (or i must've miss something on spring docus). So do please point me or explain to me the following;

1.) In TextEditor.java, it has a method setSpellChecker(SpellChecker spellChecker), and looking at the final output it displayed 3 messages. Particulalry "Inside setSpellChecker.", How was it displayed where in fact SpellChecker class has no constructor, its a setter method. does this mean upon setting of property spellChecker, setter method was called?

Disclaimer: I am new to spring and even though there is a documentation on spring site. I can't consume them all and expect that i will know all of its concept so i learn by doing and testing stuff. And this is one of those time im stuck and can't move on. wanted to learn in step by step before i go do advance stuff.

UPDATES - modified the question, i've reading it over and over again. see new question

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

"Inside setSpellChecker." is printed because spellChecker bean is injected into TextEditor using setter injection as <property> tag is used in Beans.xml.

Below steps are executed to create bean of TextEditor.

  1. Create instance of spellChecker (inner bean) so it prints 'Inside SpellChecker constructor.`
  2. Set spellChecker bean into TextEditor using TextEditor.setSpellChecker() as we are using setter injection.When TextEditor.setSpellChecker() gets called, it prints "Inside setSpellChecker" and assigns spellChecker TextEditor.spellChecker.

More on setter injection.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!