Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring Basic IOC concepts

 
Prakash Rai
Ranch Hand
Posts: 106
Eclipse IDE MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




























Output of this program is:
Hello-0 arg constr
SetA()
SetStr()
Hai-- 2 arg constr
SetHai()
setHello()
C-1 arg constr
Executon Starts in this way
B-m1
99
Hello Guys
C- m1
88
Hai Guys
D-m1
99
Hello Guys
99
Hello Guys
true
A- m1()
88
Hai Guys
99
Hello Guys

Q1. In this code I understand particular code.
But I am not able to find out flow. Please tell me proper flow .

Q2. ApplicationContext ctx=new ClassPathXmlApplicationContext("ApplicationContext.xml")
( code is creating container is it correct ?) What will be the timeout for container.





 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q2. There is no such thing as a Timeout for the container. When your application finishes and closes and in this scenario the jvm stops, then the ApplicationContext goes away.

Q1. The beginning parts is about the Initialization phase of the ApplicationContext and the steps and order that they occur.
http://tech-tauk.blogspot.com/2010/11/spring-bean-life-cycle-phases.html

The initialization phase
1) Read the xml, all the xml and all the Configuration annotations in your classes and create BeanDefinition objects of it.
2) BeanFactoryPostProcessor step. Can change the BeanDefinition objects
3) Instantiate your objects, set dependenies, set properties
4) BeanPostProcessors

So in #3 above that is when your printlns are printing at the top.

Hope that helps, and hope the link explains it in much more detail for you.

Mark
 
Prakash Rai
Ranch Hand
Posts: 106
Eclipse IDE MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going to face my 1st interview on spring... Can anyone give me the list of interview question for spring IOC and AOP ?
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somprakash Rai wrote: I am going to face my
1st interview on spring... Can anyone give me the list of interview question for spring IOC and AOP ?


Simple Googling will help.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somprakash Rai wrote: I am going to face my 1st interview on spring... Can anyone give me the list of interview question for spring IOC and AOP ?

A list of interview questions ? What are you planning to do with it ? Remember it ? You think it will give you a job ? I think it would be wiser to go to the interview with what you know, rather than with what you don't.
 
Prakash Rai
Ranch Hand
Posts: 106
Eclipse IDE MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christophe Verré.
Really I like your suggestion... Can you tell me how can I improve my Spring skills..?
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somprakash Rai wrote: Can you tell me how can I improve my Spring skills..?


  • Typically, start reading and practicing first to get a good exposure.
  • Once you are comfortable with the framework, read some best practices to avoid the pitfalls and also to strengthen your knowledge in it!


  • "Practice makes a man perfect!"
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic