Announcement Announcement Module
Collapse
No announcement yet.
New to using Spring with Servlets Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • New to using Spring with Servlets

    I'm not new to the concepts that Spring embodifies: AOP, IOC, and dependency injection totally make sense to me. I've also read through a bunch of the documentation on how to create a Spring project, you know... setting up an ApplicationContext, etc. I understand how Spring works, and the goals that it tries to address, but I don't understand how to use it with an existing server.

    I'm using Tomcat. I understand the purpose of a servlet as being more or less a Java web application, allowing developers to tap into Java as the power behind their server and the flexibility therein. I'm new to using servlets, however, as the server I do most of my work on (Red5) handles most of the setup for me. Red5 runs its own instance of Tomcat and is already wired together by Spring, so creating a new application is simple and it automagically gives developers access to Spring through dependency injection within the servlet context.

    My question is, what's the purpose of using Spring in a servlet context? I mean, I kind of understand it, but not completely. Is it to create things such as Hibernate SessionFactories and make them available to my JSP pages? If so, how do I get access to what Spring is doing in Tomcat in that case? I guess I just need to understand the concept a bit more. I've seen some tutorials on using Spring's MVC framework and I saw some weird stuff on servlet rewriting and so on and so forth, and I just don't know where to begin. Can anyone point me in the right direction? All this servlet stuff is kind of new to me.

  • #2
    Have you read the Spring MVC tutorial yet? If you haven't, that should be your first step. The concepts of spring and their uses become a lot clearer once you go through that tutorial.

    When I first started I also thought along the same lines, "What does spring bring to the table which I don't already have?". Now that the project I used spring in has become quite large, I realize the things that Spring adds, it just makes everything so simpler and easier to manage. I can also say that Spring has cut down the code base by more than 50%.

    Other than that, feel free to ask questions here.

    Comment


    • #3
      Thanks so much for pointing me in the right direction. That article totally makes sense and helps! Many thanks!

      Comment

      Working...
      X