Results 1 to 2 of 2

Thread: Accessing spring context from a servlet

  1. #1

    Question Accessing spring context from a servlet

    I basically have a simple webapp, hello world servlet, in which I want to inject a service, without using spring-mvc. Is that possible?

    Best,
    -- Thomas

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    This is not really a Spring DM question but rather a general container question. There are bridges between Servlets and the Spring container: http://static.springframework.org/sp...tegration.html
    Since servlets are managed by the web container, applying injection on them is tricky since the instance becomes managed by more then one entity (Spring + container).
    That's why in general, Servlets are used for routing requests (as a dispatcher) while the web framework takes care of creating and configuring the actual request endpoints.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •