1 //========================================================================
2 //$Id: JEEContextLoader.java 1360 2006-12-07 09:57:11Z janb $
3 //Copyright 2006 Mort Bay Consulting Pty. Ltd.
4 //------------------------------------------------------------------------
5 //Licensed under the Apache License, Version 2.0 (the "License");
6 //you may not use this file except in compliance with the License.
7 //You may obtain a copy of the License at
8 //http://www.apache.org/licenses/LICENSE-2.0
9 //Unless required by applicable law or agreed to in writing, software
10 //distributed under the License is distributed on an "AS IS" BASIS,
11 //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 //See the License for the specific language governing permissions and
13 //limitations under the License.
14 //========================================================================
15
16 package org.mortbay.jetty.spring.jee;
17
18
19 import javax.servlet.ServletContext;
20
21 import org.mortbay.log.Log;
22 import org.springframework.beans.BeansException;
23 import org.springframework.context.ApplicationContext;
24 import org.springframework.context.support.ClassPathXmlApplicationContext;
25 import org.springframework.web.context.ContextLoader;
26
27 /**
28 * JEEContextLoader
29 *
30 * Loads the spring-ejb.xml files describing ejbs from any META-INF dir in any
31 * jar or classes dir on the runtime classpath.
32 *
33 * Also loads the jee bootstrapper to perform resource injection etc on the
34 * ejbs. The bootstrapper config file is part of the jetty spring jar.
35 *
36 * This spring context will be the parent context of the usual spring web app
37 * context (ie applicationContext.xml).
38 */
39 public class JEEContextLoader extends ContextLoader
40 {
41
42 protected ApplicationContext loadParentContext(ServletContext servletContext)
43 throws BeansException
44 {
45 Log.info("Bootstrapping JEE application context");
46 ApplicationContext parentContext = new ClassPathXmlApplicationContext(
47 new String[] { "classpath*:/META-INF/spring-ejb-jar.xml"});
48
49 return parentContext;
50 }
51 }