Announcement Announcement Module
Collapse
No announcement yet.
Alternative to Startup servlet Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 09:11 AM. Reason: Servlet, Grails, Spring Beans

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

    Comment


    • #3
      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 ?

      Comment

      Working...
      X