1   package org.wcb.model.util;
2   
3   import org.springframework.context.ApplicationContext;
4   import org.springframework.context.support.ClassPathXmlApplicationContext;
5   
6   /**
7    * <small>
8    * <p>
9    * Copyright (c)  2006  wbogaardt.
10   * This library is free software; you can redistribute it and/or
11   * modify it under the terms of the GNU Lesser General Public
12   * License as published by the Free Software Foundation; either
13   * version 2.1 of the License, or (at your option) any later version.
14   *
15   * This library is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18   * Lesser General Public License for more details.
19   *
20   * You should have received a copy of the GNU Lesser General Public
21   * License along with this library; if not, write to the Free Software
22   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23   * <p/>
24   * $File:  $ <br>
25   * $Change:  $ submitted by $Author: wbogaardt $ at $DateTime: Sep 19, 2006 11:37:37 AM $ <br>
26   * </small>
27   */
28  
29  public final class SpringUtil {
30      //~ Static fields/initializers ---------------------------------------------
31  
32      /** Spring application context. */
33      private static ApplicationContext context;
34  
35      static {
36  
37          String[] files;
38          files = new String[] {"org/wcb/resources/applicationContext.xml" };
39          context = new ClassPathXmlApplicationContext(files);
40      }
41  
42      //~ Constructors -----------------------------------------------------------
43  
44      /**
45       * Creates a new SpringUtil object.
46       */
47      private SpringUtil() {
48      }
49  
50      //~ Methods ----------------------------------------------------------------
51  
52      /**
53       * Retrieve the application context.
54       *
55       * @return Returns the context.
56       */
57      public static ApplicationContext getApplicationContext() {
58          return context;
59      }
60  }