title: Setting global variable in Struts with Spring
body: <p>What is the best approach to set servlet context variable in Struts? This variable is displayed on every single page in header tile and has to be loaded from DB. For that purpose there is Hibernate DAO and Spring Service which returns the requested value.</p>
  
  <p>My current approach was to extend Struts PlugIn class and inject my service into it. This is not possible to do directly in Struts but I found a page (<a href="http://opensource.atlassian.com/confluence/spring/display/DISC/Spring-enabling+Struts+PlugIns" rel="nofollow noreferrer">http://opensource.atlassian.com/confluence/spring/display/DISC/Spring-enabling+Struts+PlugIns</a>) where Ulrik Sandberg creates a proxy which allows such functionality. This is working when I deploy my application but JUnits are failing somewhere in servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:331) on java.lang.NullPointerException.</p>
  
  <p>Is there another approach which I can take which is not going to involve debugging someone others classes?</p>