01: //========================================================================
02: //$Id: JEEContextLoader.java 1360 2006-12-07 09:57:11Z janb $
03: //Copyright 2006 Mort Bay Consulting Pty. Ltd.
04: //------------------------------------------------------------------------
05: //Licensed under the Apache License, Version 2.0 (the "License");
06: //you may not use this file except in compliance with the License.
07: //You may obtain a copy of the License at
08: //http://www.apache.org/licenses/LICENSE-2.0
09: //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: import javax.servlet.ServletContext;
19:
20: import org.mortbay.log.Log;
21: import org.springframework.beans.BeansException;
22: import org.springframework.context.ApplicationContext;
23: import org.springframework.context.support.ClassPathXmlApplicationContext;
24: import org.springframework.web.context.ContextLoader;
25:
26: /**
27: * JEEContextLoader
28: *
29: * Loads the spring-ejb.xml files describing ejbs from any META-INF dir in any
30: * jar or classes dir on the runtime classpath.
31: *
32: * Also loads the jee bootstrapper to perform resource injection etc on the
33: * ejbs. The bootstrapper config file is part of the jetty spring jar.
34: *
35: * This spring context will be the parent context of the usual spring web app
36: * context (ie applicationContext.xml).
37: */
38: public class JEEContextLoader extends ContextLoader {
39:
40: protected ApplicationContext loadParentContext(
41: ServletContext servletContext) throws BeansException {
42: Log.info("Bootstrapping JEE application context");
43: ApplicationContext parentContext = new ClassPathXmlApplicationContext(
44: new String[] { "classpath*:/META-INF/spring-ejb-jar.xml" });
45:
46: return parentContext;
47: }
48: }
|