-2

I will really appreciate, if anyone can explain below :

  1. Spring Life Cycle (How/when each component of spring (controller, dispatcher and etc ) working together to display requested page)

  2. Spring + Hibernate Life Cycle (When adding hibernate with spring how do they communicate with each other)

I didn't not find good explanation, which can be easy to understand for beginner. It will be good, if explanation includes all the main components from the framework, which will help to know the overview.

PS: I'm not asking any programming information or any opinion (which one I should use). My question is just to know the working flow. How do they work ?

Ravi
  • 30,829
  • 42
  • 119
  • 173
  • One does not require the other; your application may live happily without either Spring *or* Hibernate. Were you looking at something specific, like Spring Data or Spring JPA? – Makoto Jul 07 '15 at 02:56
  • I'm looking for life cycle of these framework. As a beginner I just wanted to know the working. Why am I creating `controller` or changing anything on `dispatcher` or somewhere. How do they work together, if adding another framework ? – Ravi Jul 07 '15 at 02:58
  • You should probably start with Spring, dependency injection, inversion of control and work from there. You'll then realize why I made the comment I did; you really don't need Spring to do Hibernate or vice-versa. – Makoto Jul 07 '15 at 02:59
  • I think, you didn't get my question. Before going for dependency injection of whatever. I just wanted to know the overview of spring and how do they work :) – Ravi Jul 07 '15 at 03:01
  • My question was very straight forward. `Life Cycle of spring` and `Life Cycle of Spring+Hibernate` – Ravi Jul 07 '15 at 03:02
  • Spring MVC life cycle http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html and http://stackoverflow.com/questions/8724259/spring-hibernate-session-lifecycle – ring bearer Jul 07 '15 at 04:06
  • @ringbearer this was helpful :) – Ravi Jul 07 '15 at 04:09
  • This can fit better as a wiki post thank a question. – Nirmal Jul 09 '15 at 03:19

1 Answers1

2

After looking at all answers and comments. I'm really disappointed the way people responded. :( I was simply asking the architecture/ life cycle of the spring framework. I don't know what people understood from my question.

Anyway coming to point. The answer, which I was looking for is nowhere related to opinion as I mentioned in my question itself. Even, I wasn't asking who is replacement of what. Thanks to @ringbearer who seems to understand my question.

Now, I found some links and I'm concluding here

Spring Life Cycle

enter image description here

From above diagram, It was quite clear for beginner to know the flow of request in Spring and this is what I was looking for.

I would like to add the explanation from this blog where It was explain in well manner.

  1. Receive the request from client
  2. Consult HandleMapping to decide which controller processes the request
  3. Dispatch the request to the controller
  4. Controller processes the request and returns the logical view name and model back to DispatcherServlet
  5. Consult ViewResolver for appropriate View for the logical view name from Controller Pass the model to View implementation for rendering
  6. View renders the model and returns the result to DispatcherServlet Return the rendered result from view to the client

Spring + Hibernate Life Cycle

AFAIK, Hibernate is a framework to interact with Database and send data to application (Spring Application) when requested. Below is the architecture of Hibernate.

enter image description here

So, from above diagram Hibernate is responsible for managing Database session and Database interaction ONLY. Spring life cycle remain same even adding Hibernate framework.

PS: Any correction will be appreciated.

Ravi
  • 30,829
  • 42
  • 119
  • 173