Announcement Announcement Module
Collapse
No announcement yet.
Retrieving WebApplicationContext? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Retrieving WebApplicationContext?

    What would be a nice way to get the WebApplicationContext once, so I can use throught my web app without allways retrive it per request?

    Thanks

  • #2
    Where do you want to store it? Are you talking about getting the context and storing it in your Controller implementation?

    Rob

    Comment


    • #3
      Bassically right now I would like to use srping in my web app without using springs MVC.

      If I understand correctly, I can add...

      <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/myApplicationContext.xml</param-value>
      </context-param>

      in my web.xml

      Then I can use...

      WebApplicationContextUtils.getWebApplicationContex t(servletContext)

      anywhere in my jsp or other MVC?

      Is it not slow to retrieve this per request or action or what not?

      Comment


      • #4
        There is no real overhead involved in that method. The ApplicationContext is bound to the ServletContext at startup. The WACUtils method just hides the lookup in ServletContext which itself is not a particulatly complex lookup.

        Rob

        Comment


        • #5
          Thanks

          Comment

          Working...
          X