Results 1 to 3 of 3

Thread: Alternative to Startup servlet

Hybrid View

  1. #1

    Default Alternative to Startup servlet

    Hi,
    I am writing an application that was initially planned for working with servlet, Now we are using groovy, we can use templates to install servlets but, I dont know how can I access spring beans defined in groovy. as previously we were initializing spring from startup servlet? Any pointers?
    Last edited by mahmood.khurram; Jun 9th, 2011 at 08:11 AM. Reason: Servlet, Grails, Spring Beans

  2. #2
    Join Date
    Jun 2010
    Location
    London
    Posts
    304

    Default

    You want to access the Spring application context from a servlet? Or do you want to do something else?

  3. #3

    Default

    I did following for servlet, it worked for me.

    Code:
    ServletContext context = getServletContext();
    ApplicationContext applicationContext = (ApplicationContext)context.getAttribute(GrailsApplicationAttributes.APPLICATION_CONTEXT);
    Now I am facing same problem with other Java classes where I want to get applicationContext.

    I am not sure if BeanBuilder will be of any help? I am not sure if beanbuilder is singleton per web-app ?

Posting Permissions

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