aspose file tools*
The moose likes Spring and the fly likes Spring Basic IOC concepts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring Basic IOC concepts" Watch "Spring Basic IOC concepts" New topic
Author

Spring Basic IOC concepts

Prakash Rai
Ranch Hand

Joined: Jan 10, 2011
Posts: 106





























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

Joined: Feb 05, 2001
Posts: 17260
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Prakash Rai
Ranch Hand

Joined: Jan 10, 2011
Posts: 106

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

Joined: Apr 20, 2006
Posts: 3355

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.


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.


[My Blog]
All roads lead to JavaRanch
Prakash Rai
Ranch Hand

Joined: Jan 10, 2011
Posts: 106

Thanks Christophe Verré.
Really I like your suggestion... Can you tell me how can I improve my Spring skills..?
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3355

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!"
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Spring Basic IOC concepts