    001// Copyright 2007, 2008, 2009 The Apache Software Foundation
    002//
    003// Licensed under the Apache License, Version 2.0 (the "License");
    004// you may not use this file except in compliance with the License.
    005// You may obtain a copy of the License at
    006//
    007//     http://www.apache.org/licenses/LICENSE-2.0
    008//
    009// Unless required by applicable law or agreed to in writing, software
    010// distributed under the License is distributed on an "AS IS" BASIS,
    011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    012// See the License for the specific language governing permissions and
    013// limitations under the License.
    014
    015package org.apache.tapestry5.spring;
    016
    017import org.apache.tapestry5.http.TapestryFilter;
    018import org.apache.tapestry5.internal.spring.SpringModuleDef;
    019import org.apache.tapestry5.ioc.def.ModuleDef;
    020
    021import javax.servlet.ServletContext;
    022
    023/**
    024 * Add logic to setup for Spring integration at startup.  In 5.1, this means creating a Spring ApplicationContext, and
    025 * wiring parts of it to resolve Tapestry objects.  In {@linkplain org.apache.tapestry5.spring.SpringConstants#USE_EXTERNAL_SPRING_CONTEXT
    026 * compatibility mode}, this means locating the externally configuration context and exposing each bean in it as a
    027 * Tapestry IoC service.
    028 */
    029public class TapestrySpringFilter extends TapestryFilter
    030{
    031    @Override
    032    protected ModuleDef[] provideExtraModuleDefs(ServletContext context)
    033    {
    034        return new ModuleDef[] {
    035                new SpringModuleDef(context)
    036        };
    037    }
    038}